moltapContentsIndex
Moltap.Prover.SplitStateMonad
Portabilityportable
Stabilityexperimental
Maintainertwanvl@gmail.com
Contents
Functions for this monad
Running computations
Description
A state+failure+split monad
Synopsis
data SSM s e a
get :: SSM s e s
put :: s -> SSM s e ()
gets :: (s -> s') -> SSM s e s'
modify :: (s -> s) -> SSM s e ()
abort :: e -> SSM s e a
split :: SSM s e a -> SSM s e a -> SSM s e a
(<?>) :: SSM s e a -> (e -> e) -> SSM s e a
runSSM :: Monoid e => s -> SSM s e a -> Either e (a, s)
evalSSM :: Monoid e => s -> SSM s e a -> Either e a
execSSM :: Monoid e => s -> SSM s e a -> Either e s
Documentation
data SSM s e a

The SplitState monad type.

This monad supports state (of type s), failure (with errors of type (e), and a split operation. State is local to branches of split, but branches are extended until the end of the computation.

show/hide Instances
Applicative (SSM s e)
Functor (SSM s e)
Monad (SSM s e)
Monoid e => MonadPlus (SSM s e)
Show (SSM s e a)
Functions for this monad
get :: SSM s e s
Get the state from a SSM
put :: s -> SSM s e ()
Change the state in a SSM
gets :: (s -> s') -> SSM s e s'
Get the state from a SSM, apply a function first
modify :: (s -> s) -> SSM s e ()
Apply a function to the state in a SSM
abort :: e -> SSM s e a
Abort the computation with an (error) result.
split :: SSM s e a -> SSM s e a -> SSM s e a
Split the computation, abort only if both halves abort. In that case, combine the errors with mappend.
(<?>) :: SSM s e a -> (e -> e) -> SSM s e a
Annotate aborts
Running computations
runSSM :: Monoid e => s -> SSM s e a -> Either e (a, s)
Run a SSM computation with the given initial state.
evalSSM :: Monoid e => s -> SSM s e a -> Either e a
Run a SSM computation with the given initial state. Return the result or an error.
execSSM :: Monoid e => s -> SSM s e a -> Either e s
Run a SSM computation with the given initial state. Return the final state or an error.
Produced by Haddock version 0.8