[Haskell-cafe] Request for a Simple Pretty Printing library

Tomasz Zielonka tomasz.zielonka at gmail.com
Wed Dec 13 16:33:43 EST 2006


On Wed, Dec 13, 2006 at 10:31:21PM +0100, Tomasz Zielonka wrote:
> I am not sure it will work, but it's sufficiently easy to try.
> Look at the innards of HughesPJ, especially the TextBeside data
> constructor. Its second parameter is an Int holding the length
> of the text. Perhaps if you created TextBeside with your HTML
> markup, but with 0 length field, things would be laid out properly.
> 
> Something like:
> 
> wrap prepend doc append =
>     zeroText prepend <> doc <> zeroText append
> zeroText s = textBeside_ (Str s) 0 Empty

Of course you will have to modify the HughesPJ library, because Doc is
an abstract data type.

Best regards
Tomasz


More information about the Haskell-Cafe mailing list