Module 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.

type status = [
  1. | `Current
  2. | `Live
  3. | `Dead
type 'a contexts
type id
module Id : sig ... end

Fork Identifiers.

module type S = sig ... end
module type S2 = sig ... end
module T1 (T : Core_kernel.T) (M : Monad) : sig ... end
module T2 (M : Monad) : sig ... end
module Make (T : Core_kernel.T) (M : Monad) : S with type 'a t := 'a T1(T)(M).t and type 'a m := 'a T1(T)(M).m and type 'a e := 'a T1(T)(M).e and type env := T.t and type id := id and module Id := Id
module Make2 (M : Monad) : S2 with type ('a, 'e) t := ('a, 'e) T2(M).t and type 'a m := 'a T2(M).m and type ('a, 'e) e := ('a, 'e) T2(M).e and type id := id and module Id := Id