[Haskell-cafe] Question about Lazy.IO
g.c.stavenga at uu.nl
Tue Sep 1 06:38:33 EDT 2009
Thanks for your reply. I am interested in a more detailed explanation. If
to long for this forum you can also mail it to me.
In response to your answer. In your program the user is also a pure
function. But I,
as a user, am not pure so I can do side effects. More specific suppose I
program something like this
ss <- hGetContent handle (lazy IO)
dosomethingweird handle ss (a function that alters the file at will)
Now as a programmer I should be positive that ss will be the file as it was
before dosomethingweird modifies it. But this can never be guaranteed if ss
is lazy. And now things start to depend on the order of evaluation breaking
referential transparency, or do I overlook something.
For concreteness suppose dosomethingweird appends ss to the end of the
file. If ss is strict then it just copies the whole file, if ss is lazy it
whole file an infinite number of times.
View this message in context: http://www.nabble.com/Question-about-Lazy.IO-tp25236848p25238044.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe