adjunctions-4.2: Adjunctions and representable functors

Stabilityexperimental
Maintainerekmett@gmail.com
Safe HaskellNone

Control.Monad.Representable.Reader

Contents

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 -> bSource

Monad Transformer

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

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

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.

Methods

ask :: m r

Retrieves the monad environment.

local

Arguments

:: (r -> r)

The function to modify the environment.

-> m a

Reader to run in the modified environment.

-> m a 

Executes a computation in a modified environment.

reader

Arguments

:: (r -> a)

The selector function to apply to the environment.

-> m a 

Retrieves a function of the current environment.

Instances

(Representable f, ~ * (Rep f) a) => MonadReader a (Co f) 
MonadReader r m => MonadReader r (MaybeT m) 
MonadReader r m => MonadReader r (ListT m) 
MonadReader r m => MonadReader r (IdentityT m) 
MonadReader r ((->) r) 
(Functor m, MonadReader e m) => MonadReader e (Free m) 
(Monoid w, MonadReader r m) => MonadReader r (WriterT w m) 
(Monoid w, MonadReader r m) => MonadReader r (WriterT w m) 
MonadReader r m => MonadReader r (StateT s m) 
MonadReader r m => MonadReader r (StateT s m) 
Monad m => MonadReader r (ReaderT r m) 
(Error e, MonadReader r m) => MonadReader r (ErrorT e m) 
MonadReader r' m => MonadReader r' (ContT r m) 
(Representable g, MonadReader e m) => MonadReader e (StateT g m) 
(Monad m, Monoid w) => MonadReader r (RWST r w s m) 
(Monad m, Monoid w) => MonadReader r (RWST r w s m)