package algaeff

  1. Overview
  2. Docs

Effects for changing states.

module S = Algaeff.State.Make (struct type state = int end)

let forty_two = S.run ~init:100 @@ fun () ->
  print_int (S.get ()); (* this will print out 100 *)
  S.set 42;
  S.get ()

This should be equivalent to Unmonad applying to the standard state monad when continuations are one-shot. (The current implementation uses mutable references and this statement has not been formally proved.)

module type Param = sig ... end

Parameters of state effects.

module type S = sig ... end

Signatures of read effects.

module Make (P : Param) : S with type state = P.state

The implementation of state effects.

OCaml

Innovation. Community. Security.