Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions prettyprinter/src/Prettyprinter/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ concatWith f ds
-- lorem ipsum dolor sit amet
--
-- For automatic line breaks, consider using 'fillSep' instead.
hsep :: [Doc ann] -> Doc ann
hsep :: Foldable f => f (Doc ann) -> Doc ann
hsep = concatWith (<+>)

-- | @('vsep' xs)@ concatenates all documents @xs@ above each other. If a
Expand Down Expand Up @@ -1006,7 +1006,7 @@ hsep = concatWith (<+>)
--
-- Since 'group'ing a 'vsep' is rather common, 'sep' is a built-in for doing
-- that.
vsep :: [Doc ann] -> Doc ann
vsep :: Foldable f => f (Doc ann) -> Doc ann
vsep = concatWith (\x y -> x <> line <> y)

-- | @('fillSep' xs)@ concatenates the documents @xs@ horizontally with @'<+>'@
Expand All @@ -1028,7 +1028,7 @@ vsep = concatWith (\x y -> x <> line <> y)
-- Docs: lorem ipsum dolor sit amet lorem
-- ipsum dolor sit amet lorem ipsum dolor
-- sit amet lorem ipsum dolor sit amet
fillSep :: [Doc ann] -> Doc ann
fillSep :: Foldable f => f (Doc ann) -> Doc ann
fillSep = concatWith (\x y -> x <> softline <> y)

-- | @('sep' xs)@ tries laying out the documents @xs@ separated with 'space's,
Expand All @@ -1051,7 +1051,7 @@ fillSep = concatWith (\x y -> x <> softline <> y)
-- @
-- 'sep' = 'group' . 'vsep'
-- @
sep :: [Doc ann] -> Doc ann
sep :: Foldable f => f (Doc ann) -> Doc ann
sep = group . vsep


Expand All @@ -1064,7 +1064,7 @@ sep = group . vsep
-- >>> let docs = Util.words "lorem ipsum dolor"
-- >>> hcat docs
-- loremipsumdolor
hcat :: [Doc ann] -> Doc ann
hcat :: Foldable f => f (Doc ann) -> Doc ann
hcat = concatWith (<>)

-- | @('vcat' xs)@ vertically concatenates the documents @xs@. If it is
Expand All @@ -1083,7 +1083,7 @@ hcat = concatWith (<>)
--
-- Since 'group'ing a 'vcat' is rather common, 'cat' is a built-in shortcut for
-- it.
vcat :: [Doc ann] -> Doc ann
vcat :: Foldable f => f (Doc ann) -> Doc ann
vcat = concatWith (\x y -> x <> line' <> y)

-- | @('fillCat' xs)@ concatenates documents @xs@ horizontally with @'<>'@ as
Expand Down Expand Up @@ -1112,7 +1112,7 @@ vcat = concatWith (\x y -> x <> line' <> y)
-- Grouped: loremipsumdolorsitametlorem
-- ipsumdolorsitametloremipsumdolorsitamet
-- loremipsumdolorsitamet
fillCat :: [Doc ann] -> Doc ann
fillCat :: Foldable f => f (Doc ann) -> Doc ann
fillCat = concatWith (\x y -> x <> softline' <> y)

-- | @('cat' xs)@ tries laying out the documents @xs@ separated with nothing,
Expand All @@ -1134,7 +1134,7 @@ fillCat = concatWith (\x y -> x <> softline' <> y)
-- @
-- 'cat' = 'group' . 'vcat'
-- @
cat :: [Doc ann] -> Doc ann
cat :: Foldable f => f (Doc ann) -> Doc ann
cat = group . vcat


Expand Down Expand Up @@ -1806,8 +1806,8 @@ defaultLayoutOptions = LayoutOptions { layoutPageWidth = defaultPageWidth }
-- | This is the default layout algorithm, and it is used by 'show', 'putDoc'
-- and 'hPutDoc'.
--
-- @'layoutPretty'@ commits to rendering something in a certain way if the
-- remainder of the current line fits the layout constraints; in other words,
-- @'layoutPretty'@ commits to rendering something in a certain way if the
-- remainder of the current line fits the layout constraints; in other words,
-- it has up to one line of lookahead when rendering. Consider using the
-- smarter, but a bit less performant, @'layoutSmart'@ algorithm if the results
-- seem to run off to the right before having lots of line breaks.
Expand Down