
19 Oct
2009
19 Oct
'09
4:18 p.m.
On Mon, Oct 19, 2009 at 12:09:02PM -0700, Michael Mossey wrote:
Note also there's no need for runReader or evalReader (at least not that I'm aware of) because unlike other monads, the reader monad is itself a function that takes the state to be read.
Note that little-r 'reader' is just an informal name for the ((->) e) monad, which is what your code was using. Control.Monad.Reader also provides the big-R 'Reader' type, which is just a newtype wrapper around a little-r reader, and does indeed have a 'runReader' method (which just removes the newtype constructor). That is, newtype Reader r a = Reader { runReader :: r -> a } C.M.Reader also provides ReaderT, a monad transformer version of Reader. -Brent