
Perhaps drawTree on
http://www.haskell.org/ghc/docs/latest/html/libraries/containers/Data-Tree.h...
2009/5/14 José Romildo Malaquias
Hello.
I would like to pretty print a tree in a way that its structure is easily perceived.
For instance, consider the declarations:
data Node a = Node a [Node a]
type Tree a = [ Node a ]
t = [ Node "a" [ Node "b" [] , Node "c" [ Node "c1" [] , Node "c2" [] ] , Node "d" [ Node "d1" [ Node "d1a" [] ] , Node "d2" [] ] ] ]
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.
I would like to see solutions for this problem, or clues on how to solve it.
Regards,
José Romildo _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe