Module
Control.Monad.Reader.Class
- Package
- purescript-transformers
- Repository
- purescript/purescript-transformers
This module defines the MonadReader
type class and its instances.
#MonadAsk Source
class (Monad m) <= MonadAsk r m | m -> r where
The MonadAsk
type class represents those monads which support a global
context that can be provided via the ask
function.
An implementation is provided for ReaderT
, and for other monad
transformers defined in this library.
Law:
do { ask ; ask } = ask
Members
ask :: m r
Instances
#MonadReader Source
class (MonadAsk r m) <= MonadReader r m | m -> r where
An extension of the MonadAsk
class that introduces a function local f x
that allows the value of the local context to be modified for the duration
of the execution of action x
.
An implementation is provided for ReaderT
, and for other monad
transformers defined in this library.
Laws in addition to the MonadAsk
law:
local f ask = f <$> ask
local _ (pure a) = pure a
local f (do { a <- x ; y }) = do { a <- local f x ; local f y }
Members
local :: forall a. (r -> r) -> m a -> m a
Instances
MonadReader r (Function r)
- Modules
- Control.
Comonad. Env - Control.
Comonad. Env. Class - Control.
Comonad. Env. Trans - Control.
Comonad. Store - Control.
Comonad. Store. Class - Control.
Comonad. Store. Trans - Control.
Comonad. Traced - Control.
Comonad. Traced. Class - Control.
Comonad. Traced. Trans - Control.
Comonad. Trans. Class - Control.
Monad. Cont - Control.
Monad. Cont. Class - Control.
Monad. Cont. Trans - Control.
Monad. Error. Class - Control.
Monad. Except - Control.
Monad. Except. Trans - Control.
Monad. List. Trans - Control.
Monad. Maybe. Trans - Control.
Monad. RWS - Control.
Monad. RWS. Trans - Control.
Monad. Reader - Control.
Monad. Reader. Class - Control.
Monad. Reader. Trans - Control.
Monad. State - Control.
Monad. State. Class - Control.
Monad. State. Trans - Control.
Monad. Trans. Class - Control.
Monad. Writer - Control.
Monad. Writer. Class - Control.
Monad. Writer. Trans