State.Multi
The Multi State monad.
The multi state monad is a generalization of a state monad where a computation can have simultaneously more than one state. It can be used to denote non-deterministic effects and concurrent computations.
The multi state monad introduces two new operators: fork
and switch
. The fork
operator clones (replicates) current state of computation (environment), the switch
operator chooses between different available states.
States form a hierarchy, with a state in which fork
is called being a parent of a newly forked state. The initial state, called the global state is an ancestor of all states.