foundation-0.0.30: Alternative prelude with batteries and no dependencies

Safe Haskell | Safe-Inferred
Language | Haskell2010

Foundation.Monad.Reader

Contents

- MonadReader
- ReaderT

Description

The Reader monad transformer.

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

Synopsis

- class Monad m => MonadReader m where
  - type ReaderContext m
  - ask :: m (ReaderContext m)
- data ReaderT r m a
- runReaderT :: ReaderT r m a -> r -> m a

# 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 Source #
MonadIO m => MonadIO (ReaderT r m) Source # |
Instance details Defined in Foundation.Monad.Reader Methods liftIO :: IO a -> ReaderT r m a Source #
Applicative m => Applicative (ReaderT r m) Source # |
Instance details Defined in Foundation.Monad.Reader Methods pure :: a -> ReaderT r m a Source # (<*>) :: ReaderT r m (a -> b) -> ReaderT r m a -> ReaderT r m b Source # liftA2 :: (a -> b -> c) -> ReaderT r m a -> ReaderT r m b -> ReaderT r m c Source # (*>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b Source # (<*) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m a Source #
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 Source # (<$) :: a -> ReaderT r m b -> ReaderT r m a Source #
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 Source # (>>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b Source # return :: a -> ReaderT r m a Source #
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 #