@@ -15,15 +15,15 @@ module Ormolu.Printer.Combinators
1515 , newline
1616 , inci
1717 , relaxComments
18− , hasMoreComments
1918 , located
2019 , locatedVia
2120 , located'
2221 , switchLayout
23− , velt
24− , velt'
2522 , vlayout
2623 , breakpoint
24+ -- ** Formatting lists
25+ , velt
26+ , velt'
2727 , withSep
2828 , spaceSep
2929 , newlineSep
@@ -66,7 +66,7 @@ txt t = ensureIndent >> spit t
6666atom :: Outputable a => a -> R ()
6767atom = txt . T.pack . showSDocUnsafe . ppr
6868
69−-- | Enter a 'Located' entity. This primitive handles outputting comments
69+-- | Enter a 'Located' entity. This combinator handles outputting comments
7070-- that may be associated with the primitive and sets corresponding layout
7171-- for the inner computation.
7272
@@ -77,7 +77,7 @@ located
7777 -> R ()
7878located loc@(L l _) = locatedVia (Just l) loc
7979
80−-- | A special version of 'located' that allows to control layout using
80+-- | A special version of 'located' that allows to control layout using an
8181-- externally provided span. 'Nothing' means that layout won't be changed.
8282
8383locatedVia
@@ -129,6 +129,15 @@ switchLayout spn = enterLayout
129129 then SingleLine
130130 else MultiLine)
131131
132+-- | Insert a space if enclosing layout is single-line, or newline if it's
133+-- multiline.
134+
135+breakpoint :: R ()
136+breakpoint = vlayout space newline
137+
138+----------------------------------------------------------------------------
139+-- Formatting lists
140+
132141-- | Element of variable layout. This means that the sub-components may be
133142-- rendered either on single line or each on its own line depending on
134143-- current layout.
@@ -151,12 +160,6 @@ velt' xs = sitcc $ sequence_ (intersperse sep (sitcc <$> xs))
151160 where
152161 sep = vlayout (spit " ") newline
153162
154−-- | Insert a space if enclosing layout is single-line, or newline if it's
155−-- multiline.
156−
157−breakpoint :: R ()
158−breakpoint = vlayout space newline
159−
160163-- | Put separator between renderings of items of a list.
161164
162165withSep
@@ -199,9 +202,12 @@ line m = do
199202-- | Surround given entity by backticks.
200203
201204backticks :: R () -> R ()
202−backticks m = txt "`" >> m >> txt "`"
205+backticks m = do
206+ txt "`"
207+ m
208+ txt "`"
203209
204−-- | Surround given entity by curly braces.
210+-- | Surround given entity by curly braces @{@ and @}@.
205211
206212braces :: R () -> R ()
207213braces m = sitcc $ do
@@ -209,7 +215,7 @@ braces m = sitcc $ do
209215 ospaces m
210216 txt "}"
211217
212−-- | Surround given entity by square brackets.
218+-- | Surround given entity by square brackets @[@ and @]@.
213219
214220brackets :: R () -> R ()
215221brackets m = sitcc $ do
@@ -217,7 +223,7 @@ brackets m = sitcc $ do
217223 ospaces m
218224 txt "]"
219225
220−-- | Surround given entity by parallel array brackets @[:@ ond @:]@.
226+-- | Surround given entity by parallel array brackets @[:@ and @:]@.
221227
222228bracketsPar :: R () -> R ()
223229bracketsPar m = sitcc $ do
@@ -225,7 +231,7 @@ bracketsPar m = sitcc $ do
225231 m
226232 txt ":]"
227233
228−-- | Surround given entity by parentheses.
234+-- | Surround given entity by parentheses @(@ and @)@.
229235
230236parens :: R () -> R ()
231237parens m = sitcc $ do