group: Add shortcut for previously grouped documents#123
group: Add shortcut for previously grouped documents#123
Conversation
|
This doesn't seem to speed up my |
|
I noticed that this shortcut only works for documents that, in a previous This makes me wonder whether we should wrap the result of the Maybe this would be a useless optimization though – benchmarking necessary! We should probably also document that |
I gave this a try: --- a/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs
+++ b/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs
@@ -527,8 +527,8 @@ group x = case x of
Union{} -> x
_ -> case changesUponFlattening x of
Flattened x' -> Union x' x
- AlreadyFlat -> x
- NeverFlat -> x
+ AlreadyFlat -> Union Fail x
+ NeverFlat -> Union Fail x
-- Note [Group: special flattening]
--
|
a7e9938 to
cded76d
Compare
This results in a significant speedup in the usual dhall benchmark. Includes #123.
|
Superseded by #140. |
Fixes #120.