foundation-0.0.8: 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 Monad m => MonadReader m where Source #

Minimal complete definition

ask

Associated Types

type ReaderContext m Source #

Methods

ask :: m (ReaderContext m) Source #

Instances

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

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

MonadTrans (ReaderT r) Source # 

Methods

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

Monad 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 #

(*>) :: 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 #

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 #

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

Associated Types

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

Methods

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

Monad 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 #