on master help sign in
Fix moving comments before module header into the export list
commit647e32299f57a550b2d1340049142899118f52cb authormrkkrp <mark.karpov@tweag.io> dateFri 1 Nov 2019, 17:58 (7 years ago) parentc5c9962
4 files changed+26−2
CHANGELOG.md+4 data/examples/module-header/preceding-comment-with-haddock-out.hs+11 data/examples/module-header/preceding-comment-with-haddock.hs+8 src/Ormolu/Printer/Meat/Module.hs+3−2
CHANGELOG.md+4
@@ -6,6 +6,10 @@
66* Fixed a minor inconsistency between formatting of normal and foreign type
77 signatures. See [issue 408](https://github.com/tweag/ormolu/issues/408).
88
9+* Fixed a bug when comment before module header with Haddock was moved
10+ inside the export list. See [issue
11+ 430](https://github.com/tweag/ormolu/issues/430).
12+
913## Ormolu 0.0.1.0
1014
1115* Initial release.
data/examples/module-header/preceding-comment-with-haddock-out.hsnew file+11
@@ -0,0 +1,11 @@
1+{-
2+ Here we go.
3+-}
4+
5+-- | This is the module's Haddock.
6+module Main
7+ ( main,
8+ )
9+where
10+
11+main = return ()
data/examples/module-header/preceding-comment-with-haddock.hsnew file+8
@@ -0,0 +1,8 @@
1+{-
2+ Here we go.
3+-}
4+
5+-- | This is the module's Haddock.
6+module Main (main) where
7+
8+main = return ()
src/Ormolu/Printer/Meat/Module.hs+3−2
@@ -31,11 +31,12 @@ p_hsModule pragmas (L moduleSpan HsModule {..}) = do
3131 switchLayout spans' $ do
3232 p_pragmas pragmas
3333 newline
34− forM_ hsmodHaddockModHeader (p_hsDocString Pipe True)
3534 case hsmodName of
3635 Nothing -> return ()
3736 Just hsmodName' -> do
38− located hsmodName' p_hsmodName
37+ located hsmodName' $ \name -> do
38+ forM_ hsmodHaddockModHeader (p_hsDocString Pipe True)
39+ p_hsmodName name
3940 forM_ hsmodDeprecMessage $ \w -> do
4041 breakpoint
4142 located' p_moduleWarning w