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

https://www.youtube.com/watch?v=pu9AGSOySlE

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.

-Michael

[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 <zhiwudazhanjiang...@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@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to