foundation-0.0.30: Alternative prelude with batteries and no dependencies
Safe HaskellSafe-Inferred
LanguageHaskell2010

Foundation.Monad.Reader

Description

The Reader monad transformer.

This is useful to keep a non-modifiable value in a context

Synopsis

MonadReader

class Monad m => MonadReader m where Source #

Associated Types

type ReaderContext m Source #

Methods

ask :: m (ReaderContext m) Source #

Instances

Instances details
MonadReader m => MonadReader (ExceptT e m) Source # 
Instance details

Defined in Foundation.Monad.Except

Associated Types

type ReaderContext (ExceptT e m) Source #

Methods

ask :: ExceptT e m (ReaderContext (ExceptT e m)) Source #

Monad m => MonadReader (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Associated Types

type ReaderContext (ReaderT r m) Source #

Methods

ask :: ReaderT r m (ReaderContext (ReaderT r m)) Source #

ReaderT

data ReaderT r m a Source #

Reader Transformer

Instances

Instances details
MonadTrans (ReaderT r) Source # 
Instance details

Defined in Foundation.Monad.Reader

Methods

lift :: Monad m => m a -> ReaderT r m a Source #

(Monad m, MonadFix m) => MonadFix (ReaderT s m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Methods

mfix :: (a -> ReaderT s m a) -> ReaderT s m a #

MonadIO m => MonadIO (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Methods

liftIO :: IO a -> ReaderT r m a #

Applicative m => Applicative (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Methods

pure :: a -> ReaderT r m a #

(<*>) :: ReaderT r m (a -> b) -> ReaderT r m a -> ReaderT r m b #

liftA2 :: (a -> b -> c) -> ReaderT r m a -> ReaderT r m b -> ReaderT r m c #

(*>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b #

(<*) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m a #

Functor m => Functor (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Methods

fmap :: (a -> b) -> ReaderT r m a -> ReaderT r m b #

(<$) :: a -> ReaderT r m b -> ReaderT r m a #

Monad m => Monad (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Methods

(>>=) :: ReaderT r m a -> (a -> ReaderT r m b) -> ReaderT r m b #

(>>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b #

return :: a -> ReaderT r m a #

MonadFailure m => MonadFailure (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Associated Types

type Failure (ReaderT r m) Source #

Methods

mFail :: Failure (ReaderT r m) -> ReaderT r m () Source #

MonadBracket m => MonadBracket (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Methods

generalBracket :: ReaderT r m a -> (a -> b -> ReaderT r m ignored1) -> (a -> SomeException -> ReaderT r m ignored2) -> (a -> ReaderT r m b) -> ReaderT r m b Source #

MonadCatch m => MonadCatch (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Methods

catch :: Exception e => ReaderT r m a -> (e -> ReaderT r m a) -> ReaderT r m a Source #

MonadThrow m => MonadThrow (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Methods

throw :: Exception e => e -> ReaderT r m a Source #

Monad m => MonadReader (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

Associated Types

type ReaderContext (ReaderT r m) Source #

Methods

ask :: ReaderT r m (ReaderContext (ReaderT r m)) Source #

type Failure (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

type Failure (ReaderT r m) = Failure m
type ReaderContext (ReaderT r m) Source # 
Instance details

Defined in Foundation.Monad.Reader

type ReaderContext (ReaderT r m) = r

runReaderT :: ReaderT r m a -> r -> m a Source #