monad-lgbt-0.0.2: Monad transformers for combining local and global state.

Safe HaskellNone
LanguageHaskell2010

Control.Monad.State.LGBT

Synopsis

Documentation

data LGBT localState globalState m a Source

LGBT monad is sandwiching state with eager BacktrackT transformer.

Instances

MonadTrans (LGBT localState globalState) Source 
Monad m => Monad (LGBT localState globalState m) Source 
Functor (LGBT localState globalState m) Source 
Applicative (LGBT localState globalState m) Source 
Applicative m => Alternative (LGBT localState globalState m) Source 
MonadPlus m => MonadPlus (LGBT localState globalState m) Source 
MonadIO m => MonadIO (LGBT localState globalState m) Source 
Monad m => MonadLGBT (LGBT localState globalState m) localState globalState Source 

data LGLT localState globalState m a Source

LGBT monad is sandwiching state with fair LogicT transformer.

Instances

MonadTrans (LGLT localState globalState) Source 
Monad (LGLT localState globalState m) Source 
Functor (LGLT localState globalState m) Source 
Applicative (LGLT localState globalState m) Source 
Alternative (LGLT localState globalState m) Source 
MonadPlus (LGLT localState globalState m) Source 
MonadIO m => MonadIO (LGLT localState globalState m) Source 
Monad m => MonadLogic (LGLT localState globalState m) Source 
Monad m => MonadLGBT (LGLT localState globalState m) localState globalState Source 

data LGCT localState globalState result m a Source

Local/global state transformer with unlimited continuations MonadCont

Instances

MonadTrans (LGCT localState globalState result) Source 
Monad (LGCT localState globalState result m) Source 
Functor (LGCT localState globalState result m) Source 
Applicative (LGCT localState globalState result m) Source 
MonadIO m => MonadIO (LGCT localState globalState result m) Source 
MonadCont (LGCT localState globalState result m) Source 

class Monad m => MonadLGBT m localState globalState | m -> localState, m -> globalState where Source

Local/global state transformer class abstracts over details of how global and local state are realized. The separation of local and global state only makes sense when we also allow for some backtracking monad in between, hence the name "Local/global backtracking transformer".

Minimal complete definition

getLocal, getGlobal, putLocal, putGlobal

Methods

getLocal :: m localState Source

getGlobal :: m globalState Source

putLocal :: localState -> m () Source

putGlobal :: globalState -> m () Source

modifyLocal :: (localState -> localState) -> m () Source

modifyGlobal :: (globalState -> globalState) -> m () Source

Instances

Monad m => MonadLGBT (LGLT localState globalState m) localState globalState Source 
Monad m => MonadLGBT (LGBT localState globalState m) localState globalState Source 

runLGBT :: forall m localState globalState result. Monad m => LGBT localState globalState m result -> localState -> globalState -> m (Either String (result, localState), globalState) Source

runLGLT :: forall m result success localState globalState. Monad m => LGLT localState globalState m success -> localState -> globalState -> (success -> localState -> globalState -> m result -> m result) -> (globalState -> m result) -> m result Source

runLGCT :: forall m localState globalState result. Monad m => LGCT localState globalState result m result -> localState -> globalState -> m ((result, localState), globalState) Source

withGlobal :: forall t m localState globalState. (Monad m, MonadTrans t, MonadLGBT (t m) localState globalState) => (globalState -> m globalState) -> t m () Source

withLocal :: forall t m localState globalState. (Monad m, MonadTrans t, MonadLGBT (t m) localState globalState) => (localState -> m localState) -> t m () Source

getsLocal :: forall m localState globalState a. MonadLGBT m localState globalState => (localState -> a) -> m a Source

getsGlobal :: forall m localState globalState a. MonadLGBT m localState globalState => (globalState -> a) -> m a Source