Proposal: Add Text.PrettyPrint.HughesPJ.zeroText

Neil Mitchell ndmitchell at
Mon Mar 12 22:48:44 EDT 2007


I propose the addition of zeroText to the HughesPJ pretty printer.
Ticket number 1217 has been opened for this issue.

[Add zeroText to Text.PrettyPrint.HughesPJ
Neil Mitchell <>**20070313023534] {
hunk ./Text/PrettyPrint/HughesPJ.hs 177
-        char, text, ptext,
+        char, text, ptext, zeroText,
hunk ./Text/PrettyPrint/HughesPJ.hs 263
+-- | Some text, but without any width. Use for non-printing text
+-- such as a HTML or Latex tags
+zeroText :: String   -> Doc
hunk ./Text/PrettyPrint/HughesPJ.hs 595
+zeroText s = textBeside_ (Str s) 0 Empty

Currently using the pretty printer it is impossible to output pretty
HTML - <b>name</b> takes up 7+4 letters in width, instead of the 4 it
really takes. With zeroText the "<b>" can be constructed to take up no

This method is essential, and cannot otherwise be implemented without
breaking the abstraction of the library. The Yhc project has cloned
HughesPJ with this 5 line change as a result - moving back to the base
version is preferable.

Please discuss. Deadline is a week after discussion stops.



More information about the Libraries mailing list