package soteria

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Reversible.Make_mutable

Functor to create a mutable reversible state. The content itself can be mutable.

Parameters

module M : sig ... end

Signature

include Mutable with type t = M.t Dynarray.t
type t = M.t Dynarray.t
val init : unit -> t

Create a new reversible state initialized with the default value.

val backtrack_n : t -> int -> unit

Remove the last n checkpoints from state.

val save : t -> unit

Save the current state as a new checkpoint.

val reset : t -> unit

Clear all checkpoints and reset to the default value.

val wrap : (M.t -> 'a * M.t) -> t -> 'a

Apply function f to the current state, updating it with the returned value.

val wrap_read : (M.t -> 'a) -> t -> 'a

Apply function f to the current state without modifying it.