Currently we have:
> diag $ group . group . group $ "x" <> line
Union
( Cat ( Char 'x' ) ( Char ' ' ) )
( Union
( Cat ( Char 'x' ) ( Char ' ' ) )
( Union
( Cat ( Char 'x' ) ( Char ' ' ) )
( Cat ( Char 'x' )
( FlatAlt Line ( Char ' ' ) )
)
)
)
It would be nice if we could get just
Union
( Cat ( Char 'x' ) ( Char ' ' ) )
( Cat ( Char 'x' )
( FlatAlt Line ( Char ' ' ) )
)
instead. This patch should do the trick:
@@ -523,6 +523,7 @@ hardline = Line
-- use of it.
group :: Doc ann -> Doc ann
-- See note [Group: special flattening]
+group x@Union{} = x
group x = case changesUponFlattening x of
Nothing -> x
Just x' -> Union x' x
But maybe we could even get this?!
Union
( Cat ( Char 'x' ) ( Char ' ' ) )
( Cat ( Char 'x' ) Line )
Related: #99, #112, #115.
Currently we have:
It would be nice if we could get just
instead. This patch should do the trick:
But maybe we could even get this?!
Related: #99, #112, #115.