
24 Nov
2010
24 Nov
'10
4:10 p.m.
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).