On Mar 13, 2010, at 18:58 , Arnoldo Muller wrote:
In order to achieve the same result in an imperative language I would have to write lots of error-prone iterators. I saw lazy I/O as a very strong point in favor of Haskell.
Besides the space leaks that can occur and that are a bit difficult to find for a newbie like me, are there any other reasons to avoid Lazy I/O?
The biggest problem is that it is completely impossible to detect, much less recover from, lazy I/O errors. (You could theoretically force the result under control of "evaluate", thus putting it back in IO, but then you lose all the laziness you wanted. Exceptions, in particular I/O exceptions, are by definition impure; so pure code can neither recognize nor deal with them.)
--
electrical and computer engineering, carnegie mellon university KF8NH