Copyright |
(c) Edward Kmett 2011
(c) Conal Elliott 2008 |
---|---|
License | BSD3 |
Maintainer | ekmett@gmail.com |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Control.Monad.Representable.Reader
Description
Representable functors on Hask are all monads, because they are isomorphic to
a
Reader
monad.
Synopsis
- type Reader f = ReaderT f Identity
- runReader :: Representable f => Reader f b -> Rep f -> b
-
newtype
ReaderT
f m b =
ReaderT
{
- getReaderT :: f (m b)
- 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 :: Type -> Type ) | m -> r where
- module Data.Functor.Rep
Representable functor monad
Monad Transformer
newtype ReaderT f m b Source #
Constructors
ReaderT | |
Fields
|
Instances
runReaderT :: Representable f => ReaderT f m b -> Rep f -> m b Source #
class Monad m => MonadReader r (m :: Type -> Type ) | m -> r where Source #
See examples in
Control.Monad.Reader
.
Note, the partially applied function type
(->) r
is a simple reader monad.
See the
instance
declaration below.
Methods
Retrieves the monad environment.
Arguments
:: (r -> r) |
The function to modify the environment. |
-> m a |
|
-> m a |
Executes a computation in a modified environment.
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) Source # | |
( Functor m, MonadReader e m) => MonadReader e ( Free m) | |
MonadReader r m => MonadReader r ( MaybeT m) | |
MonadReader r m => MonadReader r ( ListT m) | |
( Representable g, MonadReader e m) => MonadReader e ( StateT g m) Source # | |
( Functor f, Functor m, MonadReader r m) => MonadReader r ( FreeT f 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) | |
MonadReader r m => MonadReader r ( IdentityT m) | |
MonadReader r m => MonadReader r ( ExceptT e m) |
Since: mtl-2.2 |
( Error e, MonadReader r m) => MonadReader r ( ErrorT e m) | |
MonadReader r ((->) r :: Type -> Type ) | |
MonadReader r' m => MonadReader r' ( ContT r m) | |
( Monad m, Monoid w) => MonadReader r ( RWST r w s m) | |
( Monad m, Monoid w) => MonadReader r ( RWST r w s m) | |
module Data.Functor.Rep