[Haskell-beginners] Re: \x -> x < 0.5 && x > -0.5

Brent Yorgey byorgey at seas.upenn.edu
Mon Oct 19 16:18:32 EDT 2009

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.


More information about the Beginners mailing list