
23 Jan
2006
23 Jan
'06
7:46 p.m.
Dmitry Astapov wrote:
I like the approach too, but the section on IO actions, which I'm reading now, is not correct. It's not true that "a <- someAction" has the effect of associating a with someAction, with the actual work deferred until later. All of the IO associated with someAction happens at the program point where "a <- someAction" appears, whether or not it's needed later. getContents is a rare exception to this rule. It works by using unsafeInterleaveIO behind the scenes, which muddies Haskell's generally clean semantics and leads to odd impure behavior. I wish getContents were a good example of nonstrictness or laziness, but I don't think it is. -- Ben