[Haskell-cafe] Pretty printing a tree
Brent Yorgey
byorgey at seas.upenn.edu
Thu May 14 17:31:15 EDT 2009
On Thu, May 14, 2009 at 03:58:18PM -0300, José Romildo Malaquias wrote:
>
> Then the resulting of pretty printing the given tree would be something
> like the following:
>
> a
> |
> +-------------+
> | | |
> b c d
> | |
> +---+ +---+
> | | | |
> c1 c2 d1 d2
> |
> d1a
>
> There is the module Text.PrettyPrint.HughesPJ, but it lacks examples on
> how to use the pretty print combinators, and it is not well docomented.
Text.PrettyPrint.HughesPJ is actually not a good tool for this, since
it is for pretty-printing line-oriented material (i.e. source code).
I actually have a library I was developing a while ago to do the sort
of pretty-printing/layout of text that you're looking for, using a box
model similar to that of TeX, but I never released it. Hopefully I'll
get around to polishing and releasing it this summer.
-Brent
More information about the Haskell-Cafe
mailing list