[Haskell-cafe] On the purity of Haskell
Donn Cave
donn at avvanta.com
Thu Dec 29 19:33:12 CET 2011
Quoth Gregg Reynolds <dev at mobileink.com>,
..
> A minor point maybe, but germane to the original post (I hope).
It isn't - I mean, I'm not really sure what your point is, but
the example really returns the same IO value, not just one of
the same type.
Consider an example with implementation:
wint :: Int -> IO Int
wint a = let s = show a in do
putStr s
return (length s)
Now the expression "wint 994" is a value of type IO Int, and
any instance of that expression is the same value - an action
is not the same as the action's result. You can use this
value in pure Haskell expressions with confidence.
Donn
More information about the Haskell-Cafe
mailing list