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

2012-03-17 Thread Ryan Newton
Hi all, I've got a question that pertains to any of these identify-region, parse, make-expandable approaches. The main use I'd like to use the trick for (esp. Chris's Emacs version) is to deal with large intermediate compiler ASTs. But if a compiler produces a long stream of output to stdout,

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

2012-03-17 Thread Brandon Allbery
On Sat, Mar 17, 2012 at 08:55, Ryan Newton rrnew...@gmail.com wrote: - If the source is available, the compiler could be tweaked to obey a protocol, putting delimiters around collapsable output (possibly non-printing control sequences??) I believe both emacs and vim have folding

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

2012-03-17 Thread Ryan Newton
Ah, great! I gave it one very brief try with this mode: http://www.emacswiki.org/emacs/FoldingMode (folding-add-to-marks-list 'shell-mode #{{{ #}}} nil t) But I just got not on a fold. Maybe it doesn't compose with shell mode? It might be easier just to add similar functionality to a

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

2012-03-17 Thread dag.odenh...@gmail.com
On 17 March 2012 14:10, Brandon Allbery allber...@gmail.com wrote: On Sat, Mar 17, 2012 at 08:55, Ryan Newton rrnew...@gmail.com wrote: If the source is available, the compiler could be tweaked to obey a protocol, putting delimiters around collapsable output (possibly non-printing control

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

2012-03-14 Thread Johan Holmquist
I guess you want an automatically derived show that indents, but if you don't mind defining you own, Data.PrettyPrint is really nice. Here is an example that produces roughly the same as your example: import Data.PrettyPrint tree2doc Leaf = text Leaf tree2doc (Bin x l r) = text Bin $$

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

2012-03-14 Thread José Pedro Magalhães
Hi, On Wed, Mar 14, 2012 at 07:54, Johan Holmquist holmi...@gmail.com wrote: I guess you want an automatically derived show that indents, but if you don't mind defining you own, Data.PrettyPrint is really nice. Though most likely any form of pretty-printing will be generic, and can be

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

2012-03-14 Thread Heinrich Apfelmus
Christopher Done wrote: 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. Great demo video. My recent GSoC project suggestions aims

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

2012-03-13 Thread Johan Tibell
Hi all, The derived Show instance is useful, but I sometimes wish for something that's easier to read for big data types. Does anyone have an implementation of show that draws things in a hierarchical manner? Example: Given data Tree a = Leaf | Bin Int a (Tree a) (Tree a) and value =

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

2012-03-13 Thread Austin Seipp
It's not exactly hierarchical, but Groom most certainly should help with getting much prettier output: http://hackage.haskell.org/package/groom On Tue, Mar 13, 2012 at 5:33 PM, Johan Tibell johan.tib...@gmail.com wrote: Hi all, The derived Show instance is useful, but I sometimes wish for

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

2012-03-13 Thread Vincent Hanquez
On 03/13/2012 10:33 PM, Johan Tibell wrote: value = Bin 1 (Bin 2 Leaf Leaf) (Bin 3 Leaf Leaf) I'm usually using the following snippet which is a tweak of the gshow function from syb. However everything need to be a member of Data/Typeable, and also list are not particularly well handled with

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

2012-03-13 Thread Ozgur Akgun
I prefer pretty-show rather than groom as it's output is hierarchical. http://hackage.haskell.org/package/pretty-show Ozgur On 13 March 2012 22:37, Austin Seipp mad@gmail.com wrote: It's not exactly hierarchical, but Groom most certainly should help with getting much prettier output:

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

2012-03-13 Thread Christopher Done
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,