
Bulat Ziganshin wrote:
Hello Simon,
Friday, May 26, 2006, 2:52:34 PM, you wrote:
Assuming we do have imprecise exceptions what is wrong with lazy IO?
I'm not even certain that lazy I/O doesn't upset referential transparency. It seems hard to construct a concrete counter example though. My intuition is something like this: if evaluating a thunk can cause IO to take place, then the act of evaluating that thunk might affect the value of another lazy I/O computation, and hence it should be possible to get different results by evaluating the thunks in a different order. I'm concerned that in the presence of dependencies between lazy I/O computations, the order of evaluation might be visible.
of course it can if, or example, we evaluate two hGetContents on the same Handle; or read the file that is written by other computation
Both of those are illegal in Haskell. It might be possible to construct an example using pipes, though. Cheers, Simon