foundation-0.0.19: Alternative prelude with batteries and no dependencies

Safe HaskellNone
LanguageHaskell2010

Foundation.Monad.Reader

Contents

Description

The Reader monad transformer.

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

Synopsis

MonadReader

class AMPMonad m => MonadReader m where Source #

Minimal complete definition

ask

Associated Types

type ReaderContext m Source #

Methods

ask :: m (ReaderContext m) Source #

Instances

AMPMonad m => MonadReader (ReaderT r m) Source # 

Associated Types

type ReaderContext (ReaderT r m :: * -> *) :: * Source #

Methods

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

MonadReader m => MonadReader (ExceptT e m) Source # 

Associated Types

type ReaderContext (ExceptT e m :: * -> *) :: * Source #

Methods

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

ReaderT

data ReaderT r m a Source #

Reader Transformer

Instances

MonadTrans (ReaderT r) Source # 

Methods

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

AMPMonad m => Monad (ReaderT r m) Source # 

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 #

fail :: String -> ReaderT r m a #

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

Methods

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

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

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

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 #

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

Methods

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

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

Associated Types

type Failure (ReaderT r m :: * -> *) :: * #

Methods

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

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

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 # 

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 # 

Methods

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

AMPMonad m => MonadReader (ReaderT r m) Source # 

Associated Types

type ReaderContext (ReaderT r m :: * -> *) :: * Source #

Methods

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

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

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