From cded76d135d1635a5b16b7f398c13296307527c8 Mon Sep 17 00:00:00 2001 From: Simon Jakobi Date: Wed, 22 Jan 2020 18:26:52 +0100 Subject: [PATCH] group: Add shortcut for previously grouped documents Fixes #120. --- .../src/Data/Text/Prettyprint/Doc/Internal.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs b/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs index 74914b39..2e3d27ff 100755 --- a/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs +++ b/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs @@ -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] --