[Haskell-beginners] pretty-printing data

Michael Mossey mpm at alumni.caltech.edu
Sat Aug 29 10:22:06 EDT 2009


For debugging purposes I'm interested in pretty-printing data; to start 
with, lists of algebraic data types. Basically I'd like 'show' with the 
ability to put each entry of a list on a separate line, and indented. Note 
that the algebraic data might have an inner list as one of its elements, so 
this is a non-obvious formatting problem.

I believe I can make instances of Show, can I not? Is there something 
called showList which I can use to code my own method of showing lists of a 
particular type? My understanding is that I can't make [a] an instance of 
Show; hence they provided showList.

So basically, I'm wondering if a pretty-printing (for data!) library 
already exists, or whether I should try to make instances of Show.

Thanks,
Mike


More information about the Beginners mailing list