Copyright (c) Edward Kmett 2011(c) Conal Elliott 2008 BSD3 ekmett@gmail.com experimental None Haskell98

Description

Representable functors on Hask are all monads, because they are isomorphic to a Reader monad.

Synopsis

# Representable functor monad

runReader :: Representable f => Reader f b -> Rep f -> b #

newtype ReaderT f m b #

Constructors

Instances

readerT :: Representable f => (Rep f -> m b) -> ReaderT f m b #

runReaderT :: Representable f => ReaderT f m b -> Rep f -> m b #

class Monad m => MonadReader r m | m -> r where #

See examples in Control.Monad.Reader. Note, the partially applied function type (->) r is a simple reader monad. See the instance declaration below.

Minimal complete definition

Methods

ask :: m r #

Retrieves the monad environment.

local :: (r -> r) -> m a -> m a #

Executes a computation in a modified environment.

reader :: (r -> a) -> m a #

Retrieves a function of the current environment.

Instances