monad-levels-0.1.0.0: Specific levels of monad transformers

Copyright(c) Ivan Lazar Miljenovic
License3-Clause BSD-style
MaintainerIvan.Miljenovic@gmail.com
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Levels.Reader

Description

Provides a shared environment for reading values and executing sub-computations in a modified environment.

Synopsis

Documentation

ask :: HasReader r m => m r Source

Obtain the reader environment.

asks :: HasReader r m => (r -> a) -> m a Source

Retrieve a function of the current environment. An alias of reader.

reader :: forall r m a. HasReader r m => (r -> a) -> m a Source

Retrieve a function of the current environment.

local :: forall r m a. HasReader r m => (r -> r) -> m a -> m a Source

Execute a computation in a modified environment.

newtype ReaderT r m a :: * -> (* -> *) -> * -> *

The reader monad transformer, which adds a read-only environment to the given monad.

The return function ignores the environment, while >>= passes the inherited environment to both subcomputations.

Constructors

ReaderT 

Fields

runReaderT :: r -> m a
 

type HasReader r m = SatisfyConstraint (IsReader r) m Source

A monad stack containing a Reader environment of type r.

class MonadTower m => IsReader r m Source

The minimal definitions needed by a monad providing a Reader environment.