|
| Moltap.Prover.SplitStateMonad | | Portability | portable | | Stability | experimental | | Maintainer | twanvl@gmail.com |
|
|
|
|
|
| Description |
| A state+failure+split monad
|
|
| Synopsis |
|
|
|
| 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.
| Instances | |
|
|
| 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 |