[Haskell-cafe] How can I use ghci more wisely?

Michael Sloan mgsloan at gmail.com
Wed Jul 24 10:41:13 CEST 2013

This portion of haskell-mode (haskell-interactive-mode-eval-pretty) is what
the UI for something like this could look like:


This isn't an answer to your question, though, because expanding subparts
of the output doesn't drive evaluation.  It would be very cool, and quite
possible, to have a variant of the Show typeclass that had output with such
structured laziness.

Another non-answer is to take a look at using vaccum[0] and
vaccum-graphviz[1] together, to get an idea of the heap structure of
unforced values.  I've made a gist demonstrating how to use these to
visualize the heap without forcing values[2].  This doesn't show any
concrete values (as that would require some serious voodoo), but does show
how the heap changes due to thunks being forced.


[0] http://hackage.haskell.org/package/vacuum
[1] http://hackage.haskell.org/package/vacuum-graphviz
[2] https://gist.github.com/mgsloan/6068915

On Tue, Jul 23, 2013 at 7:30 PM, yi lu <zhiwudazhanjiangshi at gmail.com>wrote:

> I am wondering how can I ask ghci to show an infinite list wisely.
> When I type
> *fst ([1..],[1..10])*
> The result is what as you may guess
> *1,2,3,4,...*(continues to show, cut now)
> How could I may ghci show
> *[1..]*
> this wise way not the long long long list itself?
> Yi
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130724/efb8ee30/attachment.htm>

More information about the Haskell-Cafe mailing list