
Knowing whether a computation will terminate is in general the halting
problem, so immediately you're looking at a syntactic restriction.
Here the only ones I can think of are artificial at best (i.e., they
don't work for examples more than what you've shown here):
http://trac.haskell.org/haskell-platform/ticket/180
There was some discussion [1] on putting a limit to what the
interpreter prints out. Off the top of my head I suppose a hacky way
to do this would be to define a new type deriving show in a way that
printed out the list to some bounded depth.
Kris
[1] http://projects.haskell.org/pipermail/haskell-platform/2011-July/001619.html
On Tue, Jul 23, 2013 at 10:30 PM, yi lu
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