
29 Dec
2009
29 Dec
'09
4:05 a.m.
2009/12/29 Alexander Solla
Every Monad defines a "join" and "eval" function in terms of bind and return, and the Monad type class does this for you. You can use "join" to construct queries against a monad, and eval to "run" a monad, like a state machine. (Conceptually, the Haskell runtime calls the IO monad's "specially defined" eval method on "Main.main". This is the only Haskell monad whose eval function is not defined in terms of >>= and return, as far as I know.)
Maybe I am misunderstanding you, but `eval :: M t -> t' does not fall out of the definition of a monad. You need more than monadicity -- you need an algebra for `M' at `t'. -- Jason Dusek