deepcontrol-0.4.1.0: Provide more deeper level style of programming than the usual Control.xxx modules express

Copyright(C) 2015 KONISHI Yohsuke, (c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001
LicenseBSD-style (see the file LICENSE)
Maintainerocean0yohsuke@gmail.com
Stabilityexperimental
Portability---
Safe HaskellSafe
LanguageHaskell2010

DeepControl.Monad.Trans.RWS

Description

This module extended RWS monad in mtl(monad-transformer-library).

Synopsis

Documentation

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

See examples in Control.Monad.Reader. Note, the partially applied function type (->) r is a simple reader monad. See the instance declaration below.

Minimal complete definition

(ask | reader), local

Methods

ask :: m r

Retrieves the monad environment.

local

Arguments

:: (r -> r)

The function to modify the environment.

-> m a

Reader to run in the modified environment.

-> m a 

Executes a computation in a modified environment.

reader

Arguments

:: (r -> a)

The selector function to apply to the environment.

-> m a 

Retrieves a function of the current environment.

Instances

MonadReader r m => MonadReader r (MaybeT m) 
MonadReader r m => MonadReader r (ListT m) 
MonadReader r m => MonadReader r (IdentityT m) 
MonadReader r ((->) r) 
(Monoid w, MonadReader r m) => MonadReader r (WriterT w m) 
(Monoid w, MonadReader r m) => MonadReader r (WriterT w m) 
MonadReader r m => MonadReader r (StateT s m) 
MonadReader r m => MonadReader r (StateT s m) 
Monad m => MonadReader r (ReaderT r m) 
MonadReader r m => MonadReader r (ExceptT e m) 
(Error e, MonadReader r m) => MonadReader r (ErrorT e m) 
MonadReader r' m => MonadReader r' (ContT r m) 
(Monad m, Monoid w) => MonadReader r (RWST r w s m) 
(Monad m, Monoid w) => MonadReader r (RWST r w s m) 

class (Monoid w, Monad m) => MonadWriter w m | m -> w where

Minimal complete definition

(writer | tell), listen, pass

Methods

writer :: (a, w) -> m a

writer (a,w) embeds a simple writer action.

tell :: w -> m ()

tell w is an action that produces the output w.

listen :: m a -> m (a, w)

listen m is an action that executes the action m and adds its output to the value of the computation.

pass :: m (a, w -> w) -> m a

pass m is an action that executes the action m, which returns a value and a function, and returns the value, applying the function to the output.

Instances

MonadWriter w m => MonadWriter w (MaybeT m) 
MonadWriter w m => MonadWriter w (IdentityT m) 
(Monoid w, Monad m) => MonadWriter w (WriterT w m) 
(Monoid w, Monad m) => MonadWriter w (WriterT w m) 
MonadWriter w m => MonadWriter w (StateT s m) 
MonadWriter w m => MonadWriter w (StateT s m) 
MonadWriter w m => MonadWriter w (ReaderT r m) 
MonadWriter w m => MonadWriter w (ExceptT e m) 
(Error e, MonadWriter w m) => MonadWriter w (ErrorT e m) 
(Monoid w, Monad m) => MonadWriter w (RWST r w s m) 
(Monoid w, Monad m) => MonadWriter w (RWST r w s m) 

class Monad m => MonadState s m | m -> s where

Minimal definition is either both of get and put or just state

Minimal complete definition

state | get, put

Methods

get :: m s

Return the state from the internals of the monad.

put :: s -> m ()

Replace the state inside the monad.

state :: (s -> (a, s)) -> m a

Embed a simple state action into the monad.

Instances

MonadState s m => MonadState s (MaybeT m) 
MonadState s m => MonadState s (ListT m) 
MonadState s m => MonadState s (IdentityT m) 
(Monoid w, MonadState s m) => MonadState s (WriterT w m) 
(Monoid w, MonadState s m) => MonadState s (WriterT w m) 
Monad m => MonadState s (StateT s m) 
Monad m => MonadState s (StateT s m) 
MonadState s m => MonadState s (ReaderT r m) 
MonadState s m => MonadState s (ExceptT e m) 
(Error e, MonadState s m) => MonadState s (ErrorT e m) 
MonadState s m => MonadState s (ContT r m) 
(Monad m, Monoid w) => MonadState s (RWST r w s m) 
(Monad m, Monoid w) => MonadState s (RWST r w s m)