We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c32982 commit 51ec1d1Copy full SHA for 51ec1d1
prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs
@@ -519,10 +519,16 @@ hardline = Line
519
-- use of it.
520
group :: Doc ann -> Doc ann
521
-- See note [Group: special flattening]
522
-group x = case changesUponFlattening x of
523
- Flattened x' -> Union x' x
524
- AlreadyFlat -> x
525
- NeverFlat -> x
+group x = case x of
+ Union{} -> x
+ FlatAlt a b -> case changesUponFlattening b of
+ Flattened b' -> Union b' a
526
+ AlreadyFlat -> Union b a
527
+ NeverFlat -> a
528
+ _ -> case changesUponFlattening x of
529
+ Flattened x' -> Union x' x
530
+ AlreadyFlat -> x
531
+ NeverFlat -> x
532
533
-- Note [Group: special flattening]
534
--
0 commit comments