package unionFind

  1. Overview
  2. Docs

This module offers an implementation of STORE based on a simple form of mutable transactional references.

type 'a store
val new_store : unit -> 'a store
type 'a rref
val make : 'a store -> 'a -> 'a store * 'a rref
val get : 'a store -> 'a rref -> 'a store * 'a
val set : 'a store -> 'a rref -> 'a -> 'a store
val eq : 'a store -> 'a rref -> 'a rref -> 'a store * bool

tentatively s f runs the function f within a new transaction on the store s. If f raises an exception, then the transaction is aborted, and any updates performed by f are rolled back. Otherwise, the updates performed by f are committed.

Two transactions on a single store cannot be nested.

A cell that is created during a transaction still exists after the transaction, even if the transaction is rolled back. In that case, its content should be considered undefined.

val tentatively : 'a store -> (unit -> 'b) -> 'b
OCaml

Innovation. Community. Security.