Skip to content

Commit

Permalink
group: Add shortcut for previously grouped documents
Browse files Browse the repository at this point in the history
Fixes #120.
  • Loading branch information
sjakobi committed Jan 22, 2020
1 parent 83d7471 commit a7e9938
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,12 @@ hardline = Line
-- use of it.
group :: Doc ann -> Doc ann
-- See note [Group: special flattening]
group x = case changesUponFlattening x of
Flattened x' -> Union x' x
AlreadyFlat -> x
NeverFlat -> x
group x = case x of
Union{} -> x
_ -> case changesUponFlattening x of
Flattened x' -> Union x' x
AlreadyFlat -> x
NeverFlat -> x

-- Note [Group: special flattening]
--
Expand Down

0 comments on commit a7e9938

Please sign in to comment.