[Haskell-cafe] Lazy Lists and IO

Stefan O'Rear stefanor at cox.net
Wed Jul 11 16:46:51 EDT 2007


On Wed, Jul 11, 2007 at 10:33:06PM +0200, Chaddaï Fouché wrote:
> 2007/7/11, Andrew Coppin <andrewcoppin at btinternet.com>:
>>
>> Ouch! That's gotta sting...
>>
>> I wasn't aware that this function was so leathal. I use it constantly
>> all the time...
>>
>
> It isn't that "lethal" usually. It's only because he was using it on
> an infinite stream that it hurt so much... If you use it on a normal
> stdin or a hGetContents on a file it will be fine (though you will
> lose the advantage of its laziness, for example constant memory
> treatment).

It was not infinite.  This has nothing to do with infiniteness.

This has to do with Lazy lists and IO.

Specifically, reading to the end of a list of responses - before sending
all the requests.

Waiting for the second responce before sending the second request caused
a deadlock, even though only a finite number of responces would be
received.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070711/e58d9883/attachment.bin


More information about the Haskell-Cafe mailing list