Proposal: Add Text.PrettyPrint.HughesPJ.zeroText

Hi 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 http://www.cs.york.ac.uk/~ndm/**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 space. 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. Thanks Neil

On Tue, Mar 13, 2007 at 02:48:44AM +0000, Neil Mitchell wrote:
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.
jhc also clones a different library for the same reason (daan's pretty printer) but I called it OOB text for 'out-of-band' text. I use it mainly for xterm escape codes. I actually like Daan's pretty printer much more than the hughespj one, I find it easier to get the layout I want and clearer in general. would there be interest is something like DocLike in the main libraries? http://repetae.net/repos/Doc/DocLike.hs I find it quite useful. John -- John Meacham - ⑆repetae.net⑆john⑈

Hi
but I called it OOB text for 'out-of-band' text. I use it mainly for xterm escape codes.
I would have thought the term zeroText more accurately signifies the meaning, partly because out-of-band isn't such a commonly known phrase. If anyone can suggest anything better than zeroText, then I'm happy to hear it.
I actually like Daan's pretty printer much more than the hughespj one, I find it easier to get the layout I want and clearer in general.
I don't particularly like the hughespj, but its the one that made it into the base library. It's probably also a good candidate for coming out of the base library at some point, but thats an entirely different discussion!
would there be interest is something like DocLike in the main libraries?
I would have thought a good pretty printer library with all the various implementations and a DocLike would be nice. Not sure it belongs in the main library though - I see pretty printing more like parsing, an addon to the standard libraries. Thanks Neil

On 23/03/07, Neil Mitchell
Hi
but I called it OOB text for 'out-of-band' text. I use it mainly for xterm escape codes.
I would have thought the term zeroText more accurately signifies the meaning, partly because out-of-band isn't such a commonly known phrase. If anyone can suggest anything better than zeroText, then I'm happy to hear it.
I don't know if I prefer one over the other, but in my attached implementation of Wadler's pretty printer (basically stolen directly from the paper), I'd called this control. - Cale

Hi
I would have thought the term zeroText more accurately signifies the meaning, partly because out-of-band isn't such a commonly known phrase. If anyone can suggest anything better than zeroText, then I'm happy to hear it.
I don't know if I prefer one over the other, but in my attached implementation of Wadler's pretty printer (basically stolen directly from the paper), I'd called this control.
I don't like control because of Control.Monad Cale on IRC suggested invisible, so far thats the best name I think. Thanks Neil

On 2007-03-23, Neil Mitchell
Hi
but I called it OOB text for 'out-of-band' text. I use it mainly for xterm escape codes.
I would have thought the term zeroText more accurately signifies the meaning, partly because out-of-band isn't such a commonly known phrase. If anyone can suggest anything better than zeroText, then I'm happy to hear it.
out-of-band not commonly known? Huh. I'd have said it's quite common. zeroText doesn't say what about it is zero. -- Aaron Denney -><-

Aaron Denney writes:
On 2007-03-23, Neil Mitchell
wrote: Hi
but I called it OOB text for 'out-of-band' text. I use it mainly for xterm escape codes.
I would have thought the term zeroText more accurately signifies the meaning, partly because out-of-band isn't such a commonly known phrase. If anyone can suggest anything better than zeroText, then I'm happy to hear it.
out-of-band not commonly known? Huh. I'd have said it's quite common.
So would I, but I suppose it depends on who you're talking to.
zeroText doesn't say what about it is zero.
How about 'zeroWidthText'? It seems self-explanitory and fairly generic.
--
David Menendez
participants (5)
-
Aaron Denney
-
Cale Gibbard
-
David Menendez
-
John Meacham
-
Neil Mitchell