definitive-base-2.6.3: A small Prelude wrapper to simplify my own Haskell developments

Safe HaskellNone
LanguageHaskell2010

Algebra.Monad.Reader

Contents

Synopsis

The Reader monad

class Monad m => MonadReader r m | m -> r where Source #

Minimal complete definition

ask, local

Methods

ask :: m r Source #

local :: (r -> r) -> m a -> m a Source #

Instances

MonadReader r m => MonadReader r (Free m) Source # 

Methods

ask :: Free m r Source #

local :: (r -> r) -> Free m a -> Free m a Source #

MonadReader r m => MonadReader r (TreeT m) Source # 

Methods

ask :: TreeT m r Source #

local :: (r -> r) -> TreeT m a -> TreeT m a Source #

MonadReader r m => MonadReader r (MaybeT m) Source # 

Methods

ask :: MaybeT m r Source #

local :: (r -> r) -> MaybeT m a -> MaybeT m a Source #

MonadReader r m => MonadReader r (StrictT m) Source # 

Methods

ask :: StrictT m r Source #

local :: (r -> r) -> StrictT m a -> StrictT m a Source #

MonadReader r m => MonadReader r (LogicT m) Source # 

Methods

ask :: LogicT m r Source #

local :: (r -> r) -> LogicT m a -> LogicT m a Source #

(Traversable f, Monad f, MonadReader r g) => MonadReader r (Compose' f g) Source # 

Methods

ask :: Compose' f g r Source #

local :: (r -> r) -> Compose' f g a -> Compose' f g a Source #

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

Methods

ask :: ReaderT r m r Source #

local :: (r -> r) -> ReaderT r m a -> ReaderT r m a Source #

MonadReader r m => MonadReader r (StateT s m) Source # 

Methods

ask :: StateT s m r Source #

local :: (r -> r) -> StateT s m a -> StateT s m a Source #

(Monoid w, MonadReader r m) => MonadReader r (WriterT w m) Source # 

Methods

ask :: WriterT w m r Source #

local :: (r -> r) -> WriterT w m a -> WriterT w m a Source #

(Monad m, Monoid w) => MonadReader r (RWST r w s m) Source # 

Methods

ask :: RWST r w s m r Source #

local :: (r -> r) -> RWST r w s m a -> RWST r w s m a Source #

data ReaderT r m a Source #

A simple Reader monad

Instances

MonadCounter w acc m => MonadCounter w acc (ReaderT r m) Source # 

Methods

getCounter :: ReaderT r m acc Source #

setCounter :: acc -> ReaderT r m () Source #

(Monad m, MonadFuture n m) => MonadFuture n (ReaderT r m) Source # 

Methods

future :: n a -> ReaderT r m a Source #

MonadWriter w m => MonadWriter w (ReaderT r m) Source # 

Methods

tell :: w -> ReaderT r m () Source #

listen :: ReaderT r m a -> ReaderT r m (w, a) Source #

censor :: ReaderT r m (a, w -> w) -> ReaderT r m a Source #

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

Methods

ask :: ReaderT r m r Source #

local :: (r -> r) -> ReaderT r m a -> ReaderT r m a Source #

MonadState s m => MonadState s (ReaderT r m) Source # 

Methods

get :: ReaderT r m s Source #

put :: s -> ReaderT r m () Source #

modify :: (s -> s) -> ReaderT r m () Source #

MonadTrans (ReaderT r) Source # 

Methods

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

MonadInternal (ReaderT r) Source # 

Methods

internal :: Monad m => (forall c. m (c, a) -> m (c, b)) -> ReaderT r m a -> ReaderT r m b Source #

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

Methods

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

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

Methods

callCC :: (forall b. (a -> ReaderT r m b) -> ReaderT r m b) -> ReaderT r m a Source #

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

Methods

choose :: [a] -> ReaderT r m a Source #

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

Methods

mfix :: (a -> ReaderT r m a) -> ReaderT r m a Source #

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

Methods

join :: ReaderT r m (ReaderT r m a) -> ReaderT r m a Source #

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

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

Methods

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

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

Methods

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

MonadLogic m l => MonadLogic (ReaderT r m) (ReaderT r l) Source # 

Methods

deduce :: ReaderT r l a -> ReaderT r m (Maybe (a, ReaderT r l a)) Source #

induce :: ReaderT r m (Maybe (a, ReaderT r l a)) -> ReaderT r l a Source #

Ring (m (a, Void, Void)) => Ring (ReaderT r m a) Source # 

Methods

one :: ReaderT r m a Source #

Semiring (m (a, Void, Void)) => Semiring (ReaderT r m a) Source # 

Methods

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

Monoid (m (a, Void, Void)) => Monoid (ReaderT r m a) Source # 

Methods

zero :: ReaderT r m a Source #

Semigroup (m (a, Void, Void)) => Semigroup (ReaderT r m a) Source # 

Methods

(+) :: ReaderT r m a -> ReaderT r m a -> ReaderT r m a Source #

type Reader r a = ReaderT r Id a Source #

readerT :: (Functor m, Functor m') => Iso (ReaderT r m a) (ReaderT r' m' b) (r -> m a) (r' -> m' b) Source #

reader :: Iso (Reader r a) (Reader r' b) (r -> a) (r' -> b) Source #

Orphan instances

MonadReader r ((->) r) Source # 

Methods

ask :: r -> r Source #

local :: (r -> r) -> (r -> a) -> r -> a Source #