
29 Dec
2011
29 Dec
'11
10:16 a.m.
Quoth Gregg Reynolds
On Wed, Dec 28, 2011 at 2:44 PM, Heinrich Apfelmus
wrote: The beauty of the IO monad is that it doesn't change anything about purity. Applying the function
bar :: Int -> IO Int
to the value 2 will always give the same result:
bar 2 = bar (1+1) = bar (5-3)
Strictly speaking, that doesn't sound right.
Look again at the sentence you trimmed off the end:
Of course, the point is that this result is an *IO action* of type IO Int, it's not the Int you would get "when executing this action".
I believe that more or less points to the key to this discussion. If it didn't make sense to you, or didn't seem relevant to the question of pure functions, then it would be worth while to think more about it. Donn