[haskell-platform] #180: GHCi tries to print infinite list (like [1..])

Chris Dornan chris at chrisdornan.com
Thu Jul 28 16:27:31 BST 2011


Sorry Magnus, I have only just seen this.

Indeed the output drivers could cut out on suspicion of a loop.

I doubt if modifying Show is practical (at least I hope not!). 

Alternatively new machinery could be used that ignores Show altogether or
selectively extends it.

FWIW, I would dread the likely complexity and possible disruption that would
seem to be involved in extending show. (But that could be just me.)

Allowing ghci to, on request of the user, to switch to a built-in printer
looks easier to stand up from the user's perspective and I think this was
done in Gofer/Hugs. But the approach was abandoned (if I remember right) and
I suspect the GHC developers may not relish making such an addition.

Chris



-----Original Message-----
From: haskell-platform-bounces at projects.haskell.org
[mailto:haskell-platform-bounces at projects.haskell.org] On Behalf Of Magnus
Therning
Sent: 13 July 2011 07:15
To: haskell-platform at projects.haskell.org
Subject: Re: [haskell-platform] #180: GHCi tries to print infinite list
(like [1..])

On Tue, Jul 12, 2011 at 11:54:46PM +0100, Chris Dornan wrote:
> I think we are stuck with the current behaviour (which I find entirely 
> natural). If we can anticipate infinite lists then can we not solve 
> HP<http://plato.stanford.edu/entries/turing-machine/#5.2>
> ?

I believe many LISP REPLs allow the user to configure limits on printing of
lists, especially to avoid printing circular lists.

Just having a (user controllable) limit in GHCi on the number of items of a
list that is printed might be enough.

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus


Perl is another example of filling a tiny, short-term need, and then being a
real problem in the longer term.
     -- Alan Kay




More information about the Haskell-platform mailing list