Show-like output of GHC data types

Iavor Diatchki iavor.diatchki at gmail.com
Fri Mar 8 17:13:09 CET 2013


Hello,


On Fri, Mar 8, 2013 at 1:39 AM, Simon Peyton-Jones <simonpj at microsoft.com>wrote:

>  What I would like to see is something like:****
>
> ** **
>
> HsApp (HsApp (HsApp (HsVar "foldl'") (HsVar "+")) (HsLit 0)) (HsVar "xs")*
> ***
>
> ** **
>
> ** **
>
> We could derive ‘Show’ on everything but that would generate a LOT of new
> code, that would seldom be used.  Also ‘Show’ doesn’t pretty-print so the
> result would be illegible. ****
>
> **
>
I have a package called "pretty-show", which can convert standard `Show`
instances into human-readable form, and it can also produce HTML renditions
of `Show`-ed data structures.  It is very useful for debugging or learning
a new code base.



> **
>
> I’m a bit dubious.  Maybe a better thing might be to improve the existing
> pretty-printer so it gave you the cues you are looking for?
>
> Agreed that this is probably a better solution, although having derived
`Show` instances would allow one to see exactly what data-structure was
produced at some point, which can be helpful when figuring out how some
part of GHC works.

-Iavor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130308/107b785a/attachment.htm>


More information about the ghc-devs mailing list