Copyright | (c) Edward Kmett 2011 (c) Conal Elliott 2008 |
---|---|
License | BSD3 |
Maintainer | ekmett@gmail.com |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Representable functors on Hask are all monads, because they are isomorphic to
a Reader
monad.
Synopsis
- type Reader (f :: Type -> Type) = ReaderT f Identity
- runReader :: forall (f :: Type -> Type) b. Representable f => Reader f b -> Rep f -> b
- newtype ReaderT (f :: Type -> Type) (m :: Type -> Type) b = ReaderT {
- getReaderT :: f (m b)
- readerT :: forall (f :: Type -> Type) m b. Representable f => (Rep f -> m b) -> ReaderT f m b
- runReaderT :: forall (f :: Type -> Type) m b. 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 :: Type -> Type) (m :: Type -> Type) b Source #
ReaderT | |
|
Instances
readerT :: forall (f :: Type -> Type) m b. Representable f => (Rep f -> m b) -> ReaderT f m b Source #
runReaderT :: forall (f :: Type -> Type) m b. Representable f => ReaderT f m b -> Rep f -> m b Source #
class Monad m => MonadReader r (m :: Type -> Type) | 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.
Retrieves the monad environment.
:: (r -> r) | The function to modify the environment. |
-> m a |
|
-> m a |
Executes a computation in a modified environment.
:: (r -> a) | The selector function to apply to the environment. |
-> m a |
Retrieves a function of the current environment.
Instances
module Data.Functor.Rep