multistate-0.8.0.2: like mtl's ReaderT / WriterT / StateT, but more than one contained value/type.

Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Trans.MultiRWS.Strict

Contents

Description

The multi-valued version of mtl's RWS / RWST

Synopsis

MultiRWST

newtype MultiRWST r w s m a Source #

Constructors

MultiRWST 

Fields

Instances

MonadBase b m => MonadBase b (MultiRWST r w s m) Source # 

Methods

liftBase :: b α -> MultiRWST r w s m α #

MonadBaseControl b m => MonadBaseControl b (MultiRWST r w s m) Source # 

Associated Types

type StM (MultiRWST r w s m :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (MultiRWST r w s m) b -> b a) -> MultiRWST r w s m a #

restoreM :: StM (MultiRWST r w s m) a -> MultiRWST r w s m a #

(Monad m, ContainsType a w, Monoid a) => MonadMultiWriter a (MultiRWST r w s m) Source # 

Methods

mTell :: a -> MultiRWST r w s m () Source #

(Monad m, ContainsType a r) => MonadMultiReader a (MultiRWST r w s m) Source # 

Methods

mAsk :: MultiRWST r w s m a Source #

(Monad m, ContainsType a s) => MonadMultiGet a (MultiRWST r w s m) Source # 

Methods

mGet :: MultiRWST r w s m a Source #

(Monad m, ContainsType a s) => MonadMultiState a (MultiRWST r w s m) Source # 

Methods

mSet :: a -> MultiRWST r w s m () Source #

MonadTrans (MultiRWST r w s) Source # 

Methods

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

MonadTransControl (MultiRWST r w s) Source # 

Associated Types

type StT (MultiRWST r w s :: (* -> *) -> * -> *) a :: * #

Methods

liftWith :: Monad m => (Run (MultiRWST r w s) -> m a) -> MultiRWST r w s m a #

restoreT :: Monad m => m (StT (MultiRWST r w s) a) -> MultiRWST r w s m a #

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

Methods

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

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

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

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

Functor f => Functor (MultiRWST r w s f) Source # 

Methods

fmap :: (a -> b) -> MultiRWST r w s f a -> MultiRWST r w s f b #

(<$) :: a -> MultiRWST r w s f b -> MultiRWST r w s f a #

MonadFix m => MonadFix (MultiRWST r w s m) Source # 

Methods

mfix :: (a -> MultiRWST r w s m a) -> MultiRWST r w s m a #

(Applicative m, Monad m) => Applicative (MultiRWST r w s m) Source # 

Methods

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

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

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

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

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

Methods

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

(Functor m, Applicative m, MonadPlus m) => Alternative (MultiRWST r w s m) Source # 

Methods

empty :: MultiRWST r w s m a #

(<|>) :: MultiRWST r w s m a -> MultiRWST r w s m a -> MultiRWST r w s m a #

some :: MultiRWST r w s m a -> MultiRWST r w s m [a] #

many :: MultiRWST r w s m a -> MultiRWST r w s m [a] #

MonadPlus m => MonadPlus (MultiRWST r w s m) Source # 

Methods

mzero :: MultiRWST r w s m a #

mplus :: MultiRWST r w s m a -> MultiRWST r w s m a -> MultiRWST r w s m a #

type StT (MultiRWST r w s) a Source # 
type StT (MultiRWST r w s) a = (a, (HList r, HList w, HList s))
type StM (MultiRWST r w s m) a Source # 
type StM (MultiRWST r w s m) a = ComposeSt (MultiRWST r w s) m a

type MultiRWSTNull = MultiRWST '[] '[] '[] Source #

type MultiRWS r w s = MultiRWST r w s Identity Source #

MonadMulti classes

class Monad m => MonadMultiReader a m where Source #

All methods must be defined.

The idea is: Any monad stack is instance of MonadMultiReader a, iff the stack contains a MultiReaderT x with a element of x.

Minimal complete definition

mAsk

Methods

mAsk :: m a Source #

Instances

(MonadTrans t, Monad (t m), MonadMultiReader a m) => MonadMultiReader a (t m) Source # 

Methods

mAsk :: t m a Source #

(Monad m, ContainsType a c) => MonadMultiReader a (MultiReaderT c m) Source # 

Methods

mAsk :: MultiReaderT c m a Source #

(Monad m, ContainsType a c) => MonadMultiReader a (MultiReaderT c m) Source # 

Methods

mAsk :: MultiReaderT c m a Source #

(Monad m, ContainsType a r) => MonadMultiReader a (MultiRWST r w s m) Source # 

Methods

mAsk :: MultiRWST r w s m a Source #

(Monad m, ContainsType a r) => MonadMultiReader a (MultiRWST r w s m) Source # 

Methods

mAsk :: MultiRWST r w s m a Source #

class (Monad m, Monoid a) => MonadMultiWriter a m where Source #

Minimal complete definition

mTell

Methods

mTell :: a -> m () Source #

Instances

(MonadTrans t, Monad (t m), MonadMultiWriter a m) => MonadMultiWriter a (t m) Source # 

Methods

mTell :: a -> t m () Source #

(Monad m, ContainsType a c, Monoid a) => MonadMultiWriter a (MultiWriterT c m) Source # 

Methods

mTell :: a -> MultiWriterT c m () Source #

(Monad m, ContainsType a c, Monoid a) => MonadMultiWriter a (MultiWriterT c m) Source # 

Methods

mTell :: a -> MultiWriterT c m () Source #

(Monad m, Monoid a, HListMContains TellableFlag a cts) => MonadMultiWriter a (MultiGSTT cts m) Source # 

Methods

mTell :: a -> MultiGSTT cts m () Source #

(Monad m, Monoid a, HListMContains TellableFlag a cts) => MonadMultiWriter a (MultiGSTT cts m) Source # 

Methods

mTell :: a -> MultiGSTT cts m () Source #

(Monad m, ContainsType a w, Monoid a) => MonadMultiWriter a (MultiRWST r w s m) Source # 

Methods

mTell :: a -> MultiRWST r w s m () Source #

(Monad m, ContainsType a w, Monoid a) => MonadMultiWriter a (MultiRWST r w s m) Source # 

Methods

mTell :: a -> MultiRWST r w s m () Source #

class Monad m => MonadMultiGet a m where Source #

In contrast to MonadMultiReader, MonadMultiGet is defined for State too, so it corresponds to read-access of any kind.

Note however that for MultiRWS, only the values from the state part can be accessed via MonadMultiGet, due to limitations of the design of MultiRWS and of the type system. This is issue is resolved in the MultiGST type.

Minimal complete definition

mGet

Methods

mGet :: m a Source #

Instances

(MonadTrans t, Monad (t m), MonadMultiGet a m) => MonadMultiGet a (t m) Source # 

Methods

mGet :: t m a Source #

(Monad m, ContainsType a c) => MonadMultiGet a (MultiReaderT c m) Source # 

Methods

mGet :: MultiReaderT c m a Source #

(Monad m, ContainsType a c) => MonadMultiGet a (MultiReaderT c m) Source # 

Methods

mGet :: MultiReaderT c m a Source #

(Monad m, ContainsType a c) => MonadMultiGet a (MultiStateT c m) Source # 

Methods

mGet :: MultiStateT c m a Source #

(Monad m, ContainsType a c) => MonadMultiGet a (MultiStateT c m) Source # 

Methods

mGet :: MultiStateT c m a Source #

(Monad m, HListMContains GettableFlag a cts) => MonadMultiGet a (MultiGSTT cts m) Source # 

Methods

mGet :: MultiGSTT cts m a Source #

(Monad m, HListMContains GettableFlag a cts) => MonadMultiGet a (MultiGSTT cts m) Source # 

Methods

mGet :: MultiGSTT cts m a Source #

(Monad m, ContainsType a s) => MonadMultiGet a (MultiRWST r w s m) Source # 

Methods

mGet :: MultiRWST r w s m a Source #

(Monad m, ContainsType a s) => MonadMultiGet a (MultiRWST r w s m) Source # 

Methods

mGet :: MultiRWST r w s m a Source #

class MonadMultiGet a m => MonadMultiState a m where Source #

Minimal complete definition

mSet

Methods

mSet :: a -> m () Source #

Instances

(MonadTrans t, Monad (t m), MonadMultiState a m) => MonadMultiState a (t m) Source # 

Methods

mSet :: a -> t m () Source #

(Monad m, ContainsType a c) => MonadMultiState a (MultiStateT c m) Source # 

Methods

mSet :: a -> MultiStateT c m () Source #

(Monad m, ContainsType a c) => MonadMultiState a (MultiStateT c m) Source # 

Methods

mSet :: a -> MultiStateT c m () Source #

(Monad m, HListMContains SettableFlag a cts) => MonadMultiState a (MultiGSTT cts m) Source # 

Methods

mSet :: a -> MultiGSTT cts m () Source #

(Monad m, HListMContains SettableFlag a cts) => MonadMultiState a (MultiGSTT cts m) Source # 

Methods

mSet :: a -> MultiGSTT cts m () Source #

(Monad m, ContainsType a s) => MonadMultiState a (MultiRWST r w s m) Source # 

Methods

mSet :: a -> MultiRWST r w s m () Source #

(Monad m, ContainsType a s) => MonadMultiState a (MultiRWST r w s m) Source # 

Methods

mSet :: a -> MultiRWST r w s m () Source #

run-functions (extracting from RWST)

runMultiRWST :: (Monad m, Monoid (HList w)) => HList r -> HList s -> MultiRWST r w s m a -> m (a, HList s, HList w) Source #

runMultiRWSTASW :: (Monad m, Monoid (HList w)) => HList r -> HList s -> MultiRWST r w s m a -> m (a, HList s, HList w) Source #

runMultiRWSTW :: (Monad m, Monoid (HList w)) => HList r -> HList s -> MultiRWST r w s m a -> m (HList w) Source #

runMultiRWSTAW :: (Monad m, Monoid (HList w)) => HList r -> HList s -> MultiRWST r w s m a -> m (a, HList w) Source #

runMultiRWSTSW :: (Monad m, Monoid (HList w)) => HList r -> HList s -> MultiRWST r w s m a -> m (HList s, HList w) Source #

runMultiRWSTNil :: Monad m => MultiRWST '[] '[] '[] m a -> m a Source #

runMultiRWSTNil_ :: (Monad m, Functor m) => MultiRWST '[] '[] '[] m a -> m () Source #

with-functions (extending an RWST)

withMultiReader :: Monad m => r -> MultiRWST (r ': rs) w s m a -> MultiRWST rs w s m a Source #

withMultiReader_ :: (Functor m, Monad m) => r -> MultiRWST (r ': rs) w s m a -> MultiRWST rs w s m () Source #

withMultiReaders :: Monad m => HList r1 -> MultiRWST (Append r1 r2) w s m a -> MultiRWST r2 w s m a Source #

withMultiReaders_ :: (Functor m, Monad m) => HList r1 -> MultiRWST (Append r1 r2) w s m a -> MultiRWST r2 w s m () Source #

withMultiWriter :: (Monoid w, Monad m) => MultiRWST r (w ': ws) s m a -> MultiRWST r ws s m (a, w) Source #

withMultiWriterAW :: (Monoid w, Monad m) => MultiRWST r (w ': ws) s m a -> MultiRWST r ws s m (a, w) Source #

withMultiWriterWA :: (Monoid w, Monad m) => MultiRWST r (w ': ws) s m a -> MultiRWST r ws s m (w, a) Source #

withMultiWriterW :: (Monoid w, Monad m) => MultiRWST r (w ': ws) s m a -> MultiRWST r ws s m w Source #

withMultiWriters :: forall r w1 w2 s m a. (Monoid (HList w1), Monad m, HInit w1) => MultiRWST r (Append w1 w2) s m a -> MultiRWST r w2 s m (a, HList w1) Source #

withMultiWritersAW :: forall r w1 w2 s m a. (Monoid (HList w1), Monad m, HInit w1) => MultiRWST r (Append w1 w2) s m a -> MultiRWST r w2 s m (a, HList w1) Source #

withMultiWritersWA :: forall r w1 w2 s m a. (Monoid (HList w1), Monad m, HInit w1) => MultiRWST r (Append w1 w2) s m a -> MultiRWST r w2 s m (HList w1, a) Source #

withMultiWritersW :: forall r w1 w2 s m a. (Monoid (HList w1), Monad m, HInit w1) => MultiRWST r (Append w1 w2) s m a -> MultiRWST r w2 s m (HList w1) Source #

withMultiState :: Monad m => s -> MultiRWST r w (s ': ss) m a -> MultiRWST r w ss m (a, s) Source #

withMultiStateAS :: Monad m => s -> MultiRWST r w (s ': ss) m a -> MultiRWST r w ss m (a, s) Source #

withMultiStateSA :: Monad m => s -> MultiRWST r w (s ': ss) m a -> MultiRWST r w ss m (s, a) Source #

withMultiStateA :: Monad m => s -> MultiRWST r w (s ': ss) m a -> MultiRWST r w ss m a Source #

withMultiStateS :: Monad m => s -> MultiRWST r w (s ': ss) m a -> MultiRWST r w ss m s Source #

withMultiState_ :: (Functor m, Monad m) => s -> MultiRWST r w (s ': ss) m a -> MultiRWST r w ss m () Source #

withMultiStates :: Monad m => HList s1 -> MultiRWST r w (Append s1 s2) m a -> MultiRWST r w s2 m (a, HList s1) Source #

withMultiStatesAS :: Monad m => HList s1 -> MultiRWST r w (Append s1 s2) m a -> MultiRWST r w s2 m (a, HList s1) Source #

withMultiStatesSA :: Monad m => HList s1 -> MultiRWST r w (Append s1 s2) m a -> MultiRWST r w s2 m (HList s1, a) Source #

withMultiStatesA :: Monad m => HList s1 -> MultiRWST r w (Append s1 s2) m a -> MultiRWST r w s2 m a Source #

withMultiStatesS :: Monad m => HList s1 -> MultiRWST r w (Append s1 s2) m a -> MultiRWST r w s2 m (HList s1) Source #

withMultiStates_ :: (Functor m, Monad m) => HList s1 -> MultiRWST r w (Append s1 s2) m a -> MultiRWST r w s2 m () Source #

without-functions (reducing an RWST; inverse of with)

withoutMultiReader :: Monad m => MultiRWST rs w s m a -> MultiRWST (r ': rs) w s m a Source #

withoutMultiState :: Monad m => MultiRWST r w ss m a -> MultiRWST r w (s ': ss) m a Source #

inflate-functions (run simple transformer in MultiRWST)

inflateReader :: (Monad m, ContainsType r rs) => ReaderT r m a -> MultiRWST rs w s m a Source #

inflateWriter :: (Monad m, ContainsType w ws, Monoid w) => WriterT w m a -> MultiRWST r ws s m a Source #

inflateState :: (Monad m, MonadTrans t, MonadMultiState s (t m)) => StateT s m a -> t m a Source #

inflateMultiState :: (Functor m, Monad m) => MultiStateT s m a -> MultiRWST r w s m a Source #

other functions

mapMultiRWST :: ss ~ (HList r, HList w, HList s) => (m (a, ss) -> m' (a', ss)) -> MultiRWST r w s m a -> MultiRWST r w s m' a' Source #

mGetRawR :: Monad m => MultiRWST r w s m (HList r) Source #

mGetRawW :: Monad m => MultiRWST r w s m (HList w) Source #

mGetRawS :: Monad m => MultiRWST r w s m (HList s) Source #

mPutRawR :: Monad m => HList r -> MultiRWST r w s m () Source #

mPutRawW :: Monad m => HList w -> MultiRWST r w s m () Source #

mPutRawS :: Monad m => HList s -> MultiRWST r w s m () Source #