on master help sign in
Add newlines between most declarations in a type class
bdc8738yumiova
data/examples/declaration/class/associated-data-out.hs+5
@@ -1,11 +1,14 @@
1{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
2class Foo a where
2class Foo a where
3+
3 data FooBar a
4 data FooBar a
4
5
5-- | Something.
6-- | Something.
6class Bar a where
7class Bar a where
8+
7 -- | Bar bar
9 -- | Bar bar
8 data BarBar a
10 data BarBar a
11+
9 -- | Bar baz
12 -- | Bar baz
10 data
13 data
11 BarBaz
14 BarBaz
@@ -13,12 +16,14 @@ class Bar a where
13
16
14-- | Something more.
17-- | Something more.
15class Baz a where
18class Baz a where
19+
16 -- | Baz bar
20 -- | Baz bar
17 data
21 data
18 BazBar
22 BazBar
19 a
23 a
20 b
24 b
21 c
25 c
26+
22 -- | Baz baz
27 -- | Baz baz
23 data
28 data
24 BazBaz
29 BazBaz
data/examples/declaration/class/associated-type-defaults-out.hs+5
@@ -1,13 +1,16 @@
1{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
2class Foo a where
2class Foo a where
3+
3 type FooBar a = Int
4 type FooBar a = Int
4
5
5-- | Something.
6-- | Something.
6class Bar a where
7class Bar a where
8+
7 -- Define bar
9 -- Define bar
8 type
10 type
9 BarBar a =
11 BarBar a =
10 BarBaz a
12 BarBaz a
13+
11 -- Define baz
14 -- Define baz
12 type
15 type
13 BarBaz
16 BarBaz
@@ -16,9 +19,11 @@ class Bar a where
16 a
19 a
17
20
18class Baz a where
21class Baz a where
22+
19 type
23 type
20 BazBar
24 BazBar
21 a
25 a
26+
22 type
27 type
23 BazBar a =
28 BazBar a =
24 Bar a
29 Bar a
data/examples/declaration/class/associated-types-out.hs+5
@@ -1,11 +1,14 @@
1{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
2class Foo a where
2class Foo a where
3+
3 type FooBar a
4 type FooBar a
4
5
5-- | Something.
6-- | Something.
6class Bar a where
7class Bar a where
8+
7 -- | Bar bar
9 -- | Bar bar
8 type BarBar a
10 type BarBar a
11+
9 -- | Bar baz
12 -- | Bar baz
10 type
13 type
11 BarBaz
14 BarBaz
@@ -13,12 +16,14 @@ class Bar a where
13
16
14-- | Something more.
17-- | Something more.
15class Baz a where
18class Baz a where
19+
16 -- | Baz bar
20 -- | Baz bar
17 type
21 type
18 BazBar
22 BazBar
19 a -- Foo
23 a -- Foo
20 b -- Bar
24 b -- Bar
21 c
25 c
26+
22 -- | Baz baz
27 -- | Baz baz
23 type
28 type
24 -- After type
29 -- After type
data/examples/declaration/class/default-implementations-out.hs+7
@@ -1,10 +1,12 @@
1-- | Foo
1-- | Foo
2class Foo a where
2class Foo a where
3+
3 foo :: a -> a
4 foo :: a -> a
4 foo a = a
5 foo a = a
5
6
6-- | Bar
7-- | Bar
7class Bar a where
8class Bar a where
9+
8 bar
10 bar
9 :: a
11 :: a
10 -> Int
12 -> Int
@@ -12,20 +14,25 @@ class Bar a where
12
14
13-- | Baz
15-- | Baz
14class Baz a where
16class Baz a where
17+
15 foobar :: a -> a
18 foobar :: a -> a
16 foobar a =
19 foobar a =
17 barbaz (bazbar a)
20 barbaz (bazbar a)
21+
18 -- | Bar baz
22 -- | Bar baz
19 barbaz
23 barbaz
20 :: a -> a
24 :: a -> a
25+
21 -- | Baz bar
26 -- | Baz bar
22 bazbar
27 bazbar
23 :: a
28 :: a
24 -> a
29 -> a
30+
25 -- First comment
31 -- First comment
26 barbaz a =
32 barbaz a =
27 bazbar -- Middle comment
33 bazbar -- Middle comment
28 a
34 a
35+
29 -- Last comment
36 -- Last comment
30 bazbar a =
37 bazbar a =
31 barbaz
38 barbaz
data/examples/declaration/class/default-signatures-out.hs+4
@@ -2,18 +2,22 @@
2
2
3-- | Something.
3-- | Something.
4class Foo a where
4class Foo a where
5+
5 -- | Foo
6 -- | Foo
6 foo :: a -> String
7 foo :: a -> String
8+
7 default foo :: Show a => a -> String
9 default foo :: Show a => a -> String
8 foo = show
10 foo = show
9
11
10-- | Something else.
12-- | Something else.
11class Bar a where
13class Bar a where
14+
12 -- | Bar
15 -- | Bar
13 bar
16 bar
14 :: String
17 :: String
15 -> String
18 -> String
16 -> a
19 -> a
20+
17 -- Pointless comment
21 -- Pointless comment
18 default bar
22 default bar
19 :: ( Read a
23 :: ( Read a
data/examples/declaration/class/dependency-super-classes-out.hs+4
@@ -2,7 +2,9 @@
2
2
3-- | Something.
3-- | Something.
4class (MonadReader r s, MonadWriter w m) => MonadState s m | m -> s where
4class (MonadReader r s, MonadWriter w m) => MonadState s m | m -> s where
5+
5 get :: m s
6 get :: m s
7+
6 put :: s -> m ()
8 put :: s -> m ()
7
9
8-- | 'MonadParsec'
10-- | 'MonadParsec'
@@ -11,9 +13,11 @@ class ( Stream s -- Token streams
11 )
13 )
12 => MonadParsec e s m
14 => MonadParsec e s m
13 | m -> e s where
15 | m -> e s where
16+
14 -- | 'getState' returns state
17 -- | 'getState' returns state
15 getState
18 getState
16 :: m s
19 :: m s
20+
17 -- | 'putState' sets state
21 -- | 'putState' sets state
18 putState
22 putState
19 :: s
23 :: s
data/examples/declaration/class/functional-dependencies-out.hs+2
@@ -4,6 +4,7 @@
4class Foo a b | a -> b
4class Foo a b | a -> b
5
5
6class Bar a b | a -> b, b -> a where
6class Bar a b | a -> b, b -> a where
7+
7 bar :: a
8 bar :: a
8
9
9-- | Something else.
10-- | Something else.
@@ -13,4 +14,5 @@ class Baz a b c d
13 , a c -> b d -- Baz
14 , a c -> b d -- Baz
14 , a c d -> b
15 , a c d -> b
15 , a b d -> a b c d where
16 , a b d -> a b c d where
17+
16 baz :: a -> b
18 baz :: a -> b
data/examples/declaration/class/multi-parameters-out.hs+5
@@ -1,9 +1,11 @@
1{-# LANGUAGE MultiParamTypeClasses #-}
1{-# LANGUAGE MultiParamTypeClasses #-}
2class Foo a b where
2class Foo a b where
3+
3 foo :: a -> b
4 foo :: a -> b
4
5
5-- | Something.
6-- | Something.
6class Bar a b c d where
7class Bar a b c d where
8+
7 bar
9 bar
8 :: a
10 :: a
9 -> b
11 -> b
@@ -12,6 +14,7 @@ class Bar a b c d where
12
14
13class -- Before name
15class -- Before name
14 Baz where
16 Baz where
17+
15 baz :: Int
18 baz :: Int
16
19
17-- | Something else.
20-- | Something else.
@@ -22,8 +25,10 @@ class BarBaz
22 d -- Baz baz
25 d -- Baz baz
23 e -- Rest
26 e -- Rest
24 f where
27 f where
28+
25 barbaz
29 barbaz
26 :: a -> f
30 :: a -> f
31+
27 bazbar
32 bazbar
28 :: e
33 :: e
29 -> f
34 -> f
data/examples/declaration/class/single-parameters-out.hs+5
@@ -1,13 +1,16 @@
1-- | Something.
1-- | Something.
2class Foo a where
2class Foo a where
3+
3 foo :: a
4 foo :: a
4
5
5-- | Something more.
6-- | Something more.
6class Bar a where
7class Bar a where
8+
7 -- | Bar
9 -- | Bar
8 bar :: a -> a -> a
10 bar :: a -> a -> a
9
11
10class Baz a where
12class Baz a where
13+
11 -- | Baz
14 -- | Baz
12 baz
15 baz
13 :: ( a
16 :: ( a
@@ -17,6 +20,8 @@ class Baz a where
17 -> a -- ^ Return value
20 -> a -- ^ Return value
18
21
19class BarBaz a where
22class BarBaz a where
23+
20 barbaz
24 barbaz
21 :: a -> b
25 :: a -> b
26+
22 bazbar :: b -> a
27 bazbar :: b -> a
data/examples/declaration/signature/minimal/minimal-out.hs+4
@@ -1,5 +1,7 @@
1class Foo a where
1class Foo a where
2+
2 {-# MINIMAL (==) | ((/=), foo) #-}
3 {-# MINIMAL (==) | ((/=), foo) #-}
4+
3 {-# MINIMAL
5 {-# MINIMAL
4 a
6 a
5 | ( b, c, d
7 | ( b, c, d
@@ -8,5 +10,7 @@ class Foo a where
8 )
10 )
9 | g
11 | g
10 #-}
12 #-}
13+
11 (==) :: a -> a -> Bool
14 (==) :: a -> a -> Bool
15+
12 (/=) :: a -> a -> Bool
16 (/=) :: a -> a -> Bool
src/Ormolu/Printer/Meat/Common.hs+2−2
@@ -27,8 +27,8 @@ import RdrName (RdrName (..))
27-- | Data and type family style.
27-- | Data and type family style.
28
28
29data FamilyStyle
29data FamilyStyle
30− = Associated
30+ = Associated -- ^ Declarations in type classes
31− | Free
31+ | Free -- ^ Top-level declarations
32
32
33p_hsmodName :: ModuleName -> R ()
33p_hsmodName :: ModuleName -> R ()
34p_hsmodName mname = do
34p_hsmodName mname = do
src/Ormolu/Printer/Meat/Declaration.hs+29−22
@@ -1,6 +1,7 @@
1{-# LANGUAGE LambdaCase #-}
1{-# LANGUAGE LambdaCase #-}
2{-# LANGUAGE PatternSynonyms #-}
2{-# LANGUAGE PatternSynonyms #-}
3{-# LANGUAGE RecordWildCards #-}
3{-# LANGUAGE RecordWildCards #-}
4+{-# LANGUAGE ViewPatterns #-}
4
5
5-- | Rendering of declarations.
6-- | Rendering of declarations.
6
7
@@ -29,23 +30,24 @@ import Ormolu.Printer.Meat.Declaration.Value
29import Ormolu.Printer.Meat.Type
30import Ormolu.Printer.Meat.Type
30import Ormolu.Utils
31import Ormolu.Utils
31
32
32−p_hsDecls :: [LHsDecl GhcPs] -> R ()
33+p_hsDecls :: FamilyStyle -> [LHsDecl GhcPs] -> R ()
33−p_hsDecls decls =
34+p_hsDecls style decls =
34− forM_ (zip decls ((Just <$> drop 1 decls) ++ [Nothing])) $
35+ forM_ (zip decls ((Just <$> drop 1 decls) ++ [Nothing])) $ \(d, md) ->
35− \(d, md) -> do
36− case md of
36+ case md of
37− Nothing -> located d p_hsDecl
37+ Nothing -> located d pDecl
38− Just d' ->
38+ Just d' ->
39− if separatedDecls (unLoc d) (unLoc d')
39+ if separatedDecls (unLoc d) (unLoc d')
40− then line (located d p_hsDecl)
40+ then line (located d pDecl)
41− else located d p_hsDecl
41+ else located d pDecl
42+ where
43+ pDecl = p_hsDecl style
42
44
43−p_hsDecl :: HsDecl GhcPs -> R ()
45+p_hsDecl :: FamilyStyle -> HsDecl GhcPs -> R ()
44−p_hsDecl = \case
46+p_hsDecl style = \case
45− TyClD NoExt x -> p_tyClDecl x
47+ TyClD NoExt x -> p_tyClDecl style x
46 ValD NoExt x -> p_valDecl x
48 ValD NoExt x -> p_valDecl x
47 SigD NoExt x -> p_sigDecl x
49 SigD NoExt x -> p_sigDecl x
48− InstD NoExt x -> p_instDecl x
50+ InstD NoExt x -> p_instDecl style x
49 DerivD NoExt x -> p_derivDecl x
51 DerivD NoExt x -> p_derivDecl x
50 DefD NoExt x -> p_defaultDecl x
52 DefD NoExt x -> p_defaultDecl x
51 ForD NoExt x -> p_foreignDecl x
53 ForD NoExt x -> p_foreignDecl x
@@ -57,9 +59,9 @@ p_hsDecl = \case
57 RoleAnnotD NoExt x -> p_roleAnnot x
59 RoleAnnotD NoExt x -> p_roleAnnot x
58 XHsDecl _ -> notImplemented "XHsDecl"
60 XHsDecl _ -> notImplemented "XHsDecl"
59
61
60−p_tyClDecl :: TyClDecl GhcPs -> R ()
62+p_tyClDecl :: FamilyStyle -> TyClDecl GhcPs -> R ()
61−p_tyClDecl = \case
63+p_tyClDecl style = \case
62− FamDecl NoExt x -> p_famDecl Free x
64+ FamDecl NoExt x -> p_famDecl style x
63 SynDecl {..} -> p_synDecl tcdLName tcdTyVars tcdRhs
65 SynDecl {..} -> p_synDecl tcdLName tcdTyVars tcdRhs
64 DataDecl {..} ->
66 DataDecl {..} ->
65 p_dataDecl Associated tcdLName (tyVarsToTypes tcdTyVars) tcdDataDefn
67 p_dataDecl Associated tcdLName (tyVarsToTypes tcdTyVars) tcdDataDefn
@@ -76,11 +78,11 @@ p_tyClDecl = \case
76 tcdATDefs
78 tcdATDefs
77 XTyClDecl {} -> notImplemented "XTyClDecl"
79 XTyClDecl {} -> notImplemented "XTyClDecl"
78
80
79−p_instDecl :: InstDecl GhcPs -> R ()
81+p_instDecl :: FamilyStyle -> InstDecl GhcPs -> R ()
80−p_instDecl = \case
82+p_instDecl style = \case
81 ClsInstD NoExt x -> p_clsInstDecl x
83 ClsInstD NoExt x -> p_clsInstDecl x
82− TyFamInstD NoExt x -> p_tyFamInstDecl Free x
84+ TyFamInstD NoExt x -> p_tyFamInstDecl style x
83− DataFamInstD NoExt x -> p_dataFamInstDecl Free x
85+ DataFamInstD NoExt x -> p_dataFamInstDecl style x
84 XInstDecl _ -> notImplemented "XInstDecl"
86 XInstDecl _ -> notImplemented "XInstDecl"
85
87
86p_derivDecl :: DerivDecl GhcPs -> R ()
88p_derivDecl :: DerivDecl GhcPs -> R ()
@@ -114,8 +116,13 @@ pattern TypeSignature
114 , InlinePragma
116 , InlinePragma
115 , SpecializePragma
117 , SpecializePragma
116 , SCCPragma :: RdrName -> HsDecl GhcPs
118 , SCCPragma :: RdrName -> HsDecl GhcPs
117−pattern TypeSignature n <- SigD NoExt (TypeSig NoExt ((L _ n):_) _)
119+pattern TypeSignature n <- (sigRdrName -> Just n)
118pattern FunctionBody n <- ValD NoExt (FunBind NoExt (L _ n) _ _ _)
120pattern FunctionBody n <- ValD NoExt (FunBind NoExt (L _ n) _ _ _)
119pattern InlinePragma n <- SigD NoExt (InlineSig NoExt (L _ n) _)
121pattern InlinePragma n <- SigD NoExt (InlineSig NoExt (L _ n) _)
120pattern SpecializePragma n <- SigD NoExt (SpecSig NoExt (L _ n) _ _)
122pattern SpecializePragma n <- SigD NoExt (SpecSig NoExt (L _ n) _ _)
121pattern SCCPragma n <- SigD NoExt (SCCFunSig NoExt _ (L _ n) _)
123pattern SCCPragma n <- SigD NoExt (SCCFunSig NoExt _ (L _ n) _)
124+
125+sigRdrName :: HsDecl GhcPs -> Maybe RdrName
126+sigRdrName (SigD NoExt (TypeSig NoExt ((L _ n):_) _)) = Just n
127+sigRdrName (SigD NoExt (ClassOpSig NoExt _ ((L _ n):_) _)) = Just n
128+sigRdrName _ = Nothing
src/Ormolu/Printer/Meat/Declaration.hs-boot+3−2
@@ -6,7 +6,8 @@ where
6
6
7import GHC
7import GHC
8import Ormolu.Printer.Combinators
8import Ormolu.Printer.Combinators
9+import Ormolu.Printer.Meat.Common
9
10
10−p_hsDecls :: [LHsDecl GhcPs] -> R ()
11+p_hsDecls :: FamilyStyle -> [LHsDecl GhcPs] -> R ()
11
12
12−p_hsDecl :: HsDecl GhcPs -> R ()
13+p_hsDecl :: FamilyStyle -> HsDecl GhcPs -> R ()
src/Ormolu/Printer/Meat/Declaration/Class.hs+25−30
@@ -13,18 +13,16 @@ import Class
13import Control.Arrow
13import Control.Arrow
14import Control.Monad
14import Control.Monad
15import Data.Foldable
15import Data.Foldable
16−import Data.Function
17import Data.List (sortBy)
16import Data.List (sortBy)
17+import Data.Ord (comparing)
18+import GHC
18import Ormolu.Printer.Combinators
19import Ormolu.Printer.Combinators
19−import Ormolu.Printer.Meat.Declaration.Signature
20−import Ormolu.Printer.Meat.Declaration.Value
21−import Ormolu.Printer.Meat.Declaration.TypeFamily
22import Ormolu.Printer.Meat.Common
20import Ormolu.Printer.Meat.Common
23import Ormolu.Printer.Meat.Type
21import Ormolu.Printer.Meat.Type
24import Ormolu.Utils
22import Ormolu.Utils
25−import GHC
26import RdrName (RdrName (..))
23import RdrName (RdrName (..))
27import SrcLoc (Located, combineSrcSpans)
24import SrcLoc (Located, combineSrcSpans)
25+import {-# SOURCE #-} Ormolu.Printer.Meat.Declaration
28
26
29p_classDecl
27p_classDecl
30 :: LHsContext GhcPs
28 :: LHsContext GhcPs
@@ -60,21 +58,21 @@ p_classDecl ctx name tvars fixity fdeps csigs cdefs cats catdefs = do
60 -- location order. This happens because different declarations are stored in
58 -- location order. This happens because different declarations are stored in
61 -- different lists. Consequently, to get all the declarations in proper order,
59 -- different lists. Consequently, to get all the declarations in proper order,
62 -- they need to be manually sorted.
60 -- they need to be manually sorted.
63− let sigs = (getLoc &&& located' p_sigDecl) <$> csigs
61+ let sigs = (getLoc &&& fmap (SigD NoExt)) <$> csigs
64− defs = (getLoc &&& located' p_valDecl) <$> cdefs
62+ vals = (getLoc &&& fmap (ValD NoExt)) <$> toList cdefs
65− tyfam_decls = (getLoc &&& located' (p_famDecl Associated)) <$> cats
63+ tyFams = (getLoc &&& fmap (TyClD NoExt . FamDecl NoExt)) <$> cats
66− tyfam_defs = (getLoc &&& located' p_famDefDecl) <$> catdefs
64+ tyFamDefs =
67− decls =
65+ ( getLoc &&& fmap (InstD NoExt . TyFamInstD NoExt . defltEqnToInstDecl)
68− snd <$>
66+ ) <$> catdefs
69− sortBy
67+ allDecls =
70− (compare `on` fst)
68+ snd <$> sortBy (comparing fst) (sigs <> vals <> tyFams <> tyFamDefs)
71− (sigs <> toList defs <> tyfam_decls <> tyfam_defs)
72− if not (null decls)
69+ if not (null allDecls)
73− then do
70+ then do
74− txt " where"
71+ txt " where"
75− newline
72+ newline -- Ensure line is added after where clause.
76− inci (sequence_ decls)
73+ newline -- Add newline before first declaration.
74+ inci (p_hsDecls Associated allDecls)
77− else newline
75+ else newline
78
76
79p_classContext :: LHsContext GhcPs -> R ()
77p_classContext :: LHsContext GhcPs -> R ()
80p_classContext ctx = unless (null (unLoc ctx)) $ do
78p_classContext ctx = unless (null (unLoc ctx)) $ do
@@ -88,16 +86,6 @@ p_classFundeps fdeps = unless (null fdeps) $ do
88 txt "| "
86 txt "| "
89 velt $ withSep comma (located' p_funDep) fdeps
87 velt $ withSep comma (located' p_funDep) fdeps
90
88
91−p_famDefDecl :: TyFamDefltEqn GhcPs -> R ()
92−p_famDefDecl FamEqn {..} = do
93− txt "type"
94− breakpoint
95− let eqn = FamEqn { feqn_pats = tyVarsToTypes feqn_pats, .. }
96− hsib = HsIB { hsib_ext = NoExt, hsib_body = eqn }
97− inci (p_tyFamInstEqn hsib)
98− newline
99−p_famDefDecl XFamEqn {} = notImplemented "XFamEqn"
100−
101p_funDep :: FunDep (Located RdrName) -> R ()
89p_funDep :: FunDep (Located RdrName) -> R ()
102p_funDep (before, after) = do
90p_funDep (before, after) = do
103 spaceSep p_rdrName before
91 spaceSep p_rdrName before
@@ -107,6 +95,13 @@ p_funDep (before, after) = do
107----------------------------------------------------------------------------
95----------------------------------------------------------------------------
108-- Helpers
96-- Helpers
109
97
98+defltEqnToInstDecl :: TyFamDefltEqn GhcPs -> TyFamInstDecl GhcPs
99+defltEqnToInstDecl FamEqn {..} = TyFamInstDecl {..}
100+ where
101+ eqn = FamEqn {feqn_pats = tyVarsToTypes feqn_pats, ..}
102+ tfid_eqn = HsIB {hsib_ext = NoExt, hsib_body = eqn}
103+defltEqnToInstDecl XFamEqn {} = notImplemented "XFamEqn"
104+
110isInfix :: LexicalFixity -> Bool
105isInfix :: LexicalFixity -> Bool
111isInfix = \case
106isInfix = \case
112 Infix -> True
107 Infix -> True
src/Ormolu/Printer/Meat/Declaration/Value.hs+1−1
@@ -605,7 +605,7 @@ p_hsBracket :: HsBracket GhcPs -> R ()
605p_hsBracket = \case
605p_hsBracket = \case
606 ExpBr NoExt expr -> quote "e" (located expr p_hsExpr)
606 ExpBr NoExt expr -> quote "e" (located expr p_hsExpr)
607 PatBr NoExt pat -> quote "p" (located pat p_pat)
607 PatBr NoExt pat -> quote "p" (located pat p_pat)
608− DecBrL NoExt decls -> quote "d" (p_hsDecls decls)
608+ DecBrL NoExt decls -> quote "d" (p_hsDecls Free decls)
609 DecBrG NoExt _ -> notImplemented "DecBrG" -- result of renamer
609 DecBrG NoExt _ -> notImplemented "DecBrG" -- result of renamer
610 TypBr NoExt ty -> quote "t" (located ty p_hsType)
610 TypBr NoExt ty -> quote "t" (located ty p_hsType)
611 VarBr NoExt _ _ -> notImplemented "VarBr"
611 VarBr NoExt _ _ -> notImplemented "VarBr"
src/Ormolu/Printer/Meat/Module.hs+1−1
@@ -49,7 +49,7 @@ p_hsModule loc@(L moduleSpan hsModule) = do
49 when (not (null hsmodImports) || not (null hsmodDecls)) newline
49 when (not (null hsmodImports) || not (null hsmodDecls)) newline
50 forM_ (sortImports hsmodImports) (located' p_hsmodImport)
50 forM_ (sortImports hsmodImports) (located' p_hsmodImport)
51 when (not (null hsmodImports) && not (null hsmodDecls)) newline
51 when (not (null hsmodImports) && not (null hsmodDecls)) newline
52− p_hsDecls hsmodDecls
52+ p_hsDecls Free hsmodDecls
53 trailingComments <- hasMoreComments
53 trailingComments <- hasMoreComments
54 when (trailingComments && isJust hsmodName) newline
54 when (trailingComments && isJust hsmodName) newline
55 spitRemainingComments
55 spitRemainingComments