[Haskell-cafe] getContents and lazy evaluation

Donn Cave donn at drizzle.com
Fri Sep 1 18:01:23 EDT 2006

On Fri, 1 Sep 2006, Robert Dockins wrote:
> On Friday 01 September 2006 16:46, Duncan Coutts wrote:
>> Note also, that with lazy IO we can write really short programs that are
>> blindingly quick. Lazy IO allows us to save a copy through the Handle
>> buffer.

(Never understood why some people think it would be such a good thing
to be blinded, but as long as it's you and not me ... )

>> BTW in the above case the "bad thing that will happen" is that contents
>> will be truncated. As I said, I think it's better to throw an exception,
>> which is what Data.ByteString.Lazy.hGetContents does.
> Well, AFAIK, the behavior is officially undefined, which is my real beef.  I 
> agree that it _should_ throw an exception.

Is this about Microsoft Windows?  On UNIX, I would expect deletion of
a file to have no effect on I/O of any kind on that file.  I thought
the problems with hGetContents more commonly involve operations on
the file handle, e.g., hClose.

	Donn Cave, donn at drizzle.com

More information about the Haskell-Cafe mailing list