mtl-c-0.1.1: Very strict CPS'd transformers

Safe HaskellSafe
LanguageHaskell98

Control.Monad.RWS.CPS

Contents

Synopsis

The RWST monad transformer

newtype RWST r w s m a Source #

A monad transformer adding reading an environment of type r, collecting an output of type w and updating a state of type s to an inner monad m.

Constructors

RWST 

Fields

  • unRWST :: forall x. r -> s -> w -> (a -> s -> w -> m x) -> m x
     

Instances

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

Methods

ask :: RWST r w s m r #

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

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

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

Methods

get :: RWST r w s m s #

put :: s -> RWST r w s m () #

state :: (s -> (a, s)) -> RWST r w s m a #

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

Methods

writer :: (a, w) -> RWST r w s m a #

tell :: w -> RWST r w s m () #

listen :: RWST r w s m a -> RWST r w s m (a, w) #

pass :: RWST r w s m (a, w -> w) -> RWST r w s m a #

MonadTrans (RWST r w s) Source # 

Methods

lift :: Monad m => m a -> RWST r w s m a #

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

Methods

(>>=) :: RWST r w s m a -> (a -> RWST r w s m b) -> RWST r w s m b #

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

return :: a -> RWST r w s m a #

fail :: String -> RWST r w s m a #

Functor (RWST r w s m) Source # 

Methods

fmap :: (a -> b) -> RWST r w s m a -> RWST r w s m b #

(<$) :: a -> RWST r w s m b -> RWST r w s m a #

Applicative (RWST r w s m) Source # 

Methods

pure :: a -> RWST r w s m a #

(<*>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b #

(*>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b #

(<*) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a #

MonadIO m => MonadIO (RWST r w s m) Source # 

Methods

liftIO :: IO a -> RWST r w s m a #

runRWST :: (Monad m, Monoid w) => RWST r w s m a -> r -> s -> m (a, s, w) Source #

evalRWST Source #

Arguments

:: (Monad m, Monoid w) 
=> RWST r w s m a

computation to execute

-> r

initial environment

-> s

initial value

-> m (a, w)

computation yielding final value and output

Evaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.

execRWST Source #

Arguments

:: (Monad m, Monoid w) 
=> RWST r w s m a

computation to execute

-> r

initial environment

-> s

initial value

-> m (s, w)

computation yielding final state and output

Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.

Re-exports