I use wl-pprint package, because the standard PrettyPrinter lacks functionality. All is good, except an empty doc in a vcat
function (the same thing with <$>
combinator).
Correct behavior:
import Text.PrettyPrint
> vcat[text "a", empty, text "b"]
a
b
wl-pprint shows an extra blank line:
import Text.PrettyPrint.Leijen
> vcat[text "a", empty, text "b"]
a
b
So what can I do? It is imposible to filter vcat list, because there is no Eq
instance for Doc
.
Because I hadn't have any better ideas, I made the following changes in the source
(<$$>) :: Doc -> Doc -> Doc
x <$$> Empty = x -- <<< added
Empty <$$> y = y -- <<< added
x <$$> y = x <> linebreak <> y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With