[Haskell-beginners] "pure" versus "impure" code
tom.davie at gmail.com
Fri May 20 17:52:06 CEST 2011
The definition of pure code is very simple. Pure code always returns the same value given the same arguments. The issue comes in the subtleties of arguments of the IO monad. Functions that produce IO actions are pure – they always produce the same IO action given the same arguments. What's not pure is the runtime which then interprets the IO action. The result of this is that you only get the nice guarantees that purity gives you when considering which IO action is produced, not when considering the effects of the IO action being executed by the runtime.
More information about the Beginners