How to avoid trailing whitespace generated by Text.PrettyPrint.HughesPJ?

Henning Thielemann lemming at
Fri Mar 8 22:31:20 CET 2013

On Sat, 9 Mar 2013, Ivan Lazar Miljenovic wrote:

> The pretty-printer is doing what it _should_ be doing here (namely
> indenting everything in that block); to get rid of unneeded trailing
> whitespace the only thing I can think of is to post-process the output
> (e.g.: unlines . reverse . dropWhile isSpace .  reverse . lines).

You certainly mean

    unlines . map (reverse . dropWhile isSpace .  reverse) . lines

Btw. (dropWhileRev isSpace) would be lazier:

More information about the Libraries mailing list