
30 Sep
2012
30 Sep
'12
7 a.m.
Vasili I. Galchin wrote:
I would an examples of monads that are pure, i.e. no side-effects.
One view of programming in monadic style is: You call return and >>= all the time. (Either you call it directly, or do notation calls it for you). So if you want to understand whether a monad "has side-effects", you should look at the implementation of return and >>=. If the implementation of return and >>= is written in pure Haskell (without unsafePerformIO or calling C code etc.), the monad is pure. Tillmann