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

Peter Simons simons at
Sat Mar 9 08:53:10 CET 2013

Hi Ivan,

 >>   *Main> test1
 >>   ____line_1
 >>   ____
 >>   ____line_2
 > The pretty-printer is doing what it _should_ be doing here (namely
 > indenting everything in that block).

when you say "everything" you really mean "nothing", right? Notice that
the line is empty. There is nothing to indent and these blanks are quite
unnecessary. It's a bit of a stretch to say that the pretty printer
should be adding them despite the fact that they serve no purpose.

 > 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).

Well, if there is no other choice, then I'll do that.

Take care,

More information about the Libraries mailing list