[Haskell-cafe] getContents and lazy evaluation

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Sep 1 18:47:20 EDT 2006


On Fri, 2006-09-01 at 17:36 -0400, Robert Dockins wrote:

> Perhaps I should be more clear.  When I said "advanced" above I meant "any use 
> whereby you treat a file as random access, read/write storage, or do any kind 
> of directory manipulation (including deleting and or renaming files)".  Lazy 
> I/O (as it currently stands) doesn't play very nice with those use cases.

Indeed, it can't be used in that case.

> I agree generally with the idea that lazy I/O is good.  The problem is that it 
> is a "leaky abstraction"; details are exposed to the user that should ideally 
> be completely hidden.  Unfortunately, the leaks aren't likely to get plugged 
> without pretty tight operating system support, which I suspect won't be 
> happening anytime soon.

Yes it is leaky.

> Well, AFAIK, the behavior is officially undefined, which is my real beef.  I 
> agree that it _should_ throw an exception.

Ah, I had thought it was defined to simply truncate. It being undefined
isn't good. It seems that it would be straightforward to define it to
have the truncation behaviour. If Haskell-prime gets imprecise
exceptions then that could be changed.

Duncan



More information about the Haskell-Cafe mailing list