[Haskell-cafe] Prettier pretty-printing of data types?

Christopher Done chrisdone at googlemail.com
Wed Mar 14 00:39:00 CET 2012


Maybe an Emacs script to expand the nodes nicely:
http://www.youtube.com/watch?v=6ofEZQ7XoEA I don't find mere pretty
printing that useful compared to the “expanding” paradigm I'm used to in
Chrome and Firebug.

To try it just M-x eval-buffer on these two files,

http://www.emacswiki.org/emacs/download/peg.el
https://raw.github.com/chrisdone/haskell-emacs/master/src/hs-show.el

then make some fresh empty buffer with some demo Show output code:

BinJab 1 (Biny 2 Leaf Leaf) (Binpo 3 Leaf Leaf) (Binamr 3 Leaf (Lalar 3
Leaf Leaf))

and try, maybe, M-: (hs-show-replace (point-min) (point-max))

you should get “BinJab”, and then clicking it will give you more until you
have: http://i.imgur.com/a7rvz.png

The parser is of course a PEG parser within elisp so it kind of sucks for
large data structures (limited by Elisp's stack, and is super slow). My
haskell-emacs package has it in the REPL but I want to replace this parser
with a haskell-src-exts→sexp utility to make it faster and more reliable.
If anyone wants to replace the parser (and indeed the "shower") as
described, I'd be very happy as this is a Super Nice feature and
indispensable in the REPL with “real” data.

Ciao!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120314/c7cd027f/attachment.htm>


More information about the Haskell-Cafe mailing list