[Haskell-cafe] On the purity of Haskell

Chris Smith cdsmith at gmail.com
Fri Dec 30 18:11:03 CET 2011


> time t:  f 42   (computational process implementing func application
> begins…)
> t+1:   <keystroke> = 1
> t+2:  43   (… and ends)
> 
> 
> time t+3:  f 42
> t+4:  <keystroke> = 2
> t+5:  44
> 
> 
> Conclusion:  f 42 != f 42

That conclusion would only follow if the same IO action always produced
the same result when performed twice in a row.  That's obviously untrue,
so the conclusion doesn't follow.  What you've done is entirely
consistent with the fact that f 42 = f 42... it just demonstrates that
whatever f 42 is, it doesn't always produce the same result when you o
it twice.

What Conal is getting at is that we don't have a formal model of what an
IO action means.  Nevertheless, we know because f is a function, that
when it is applied twice to the same argument, the values we get back
(which are IO actions, NOT integers) are the same.

-- 
Chris Smith






More information about the Haskell-Cafe mailing list