[Haskell-cafe] Monadic function purity

Daniel Fischer daniel.is.fischer at web.de
Wed Nov 24 16:10:20 EST 2010


On Wednesday 24 November 2010 21:46:22, Gregory Propf wrote:
> I have a pretty basic question.  I've been wondering about whether
> monadic functions that do NOT us IO can be pure or not.  There seems to
> be some confusion on this topic on the web.  I'm especially interested
> in whether they can be memoized.  It seems to me that something like a
> function in the State monad should be pure provided the same initial
> state and same function arguments are present.  Likewise with the list
> monad and most other monads in fact.

Yes, most monads are unambiguously pure.
From a suitable point of view, IO is pure too (the functions assembling the 
IO-actions are pure, impurity is constrained to the RTS executing the IO-
actions).


More information about the Haskell-Cafe mailing list