package unionFind

  1. Overview
  2. Docs

Module UnionFind.StoreTransactionalRefSource

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

Sourcetype 'a store
Sourceval new_store : unit -> 'a store
Sourcetype 'a rref
Sourceval make : 'a store -> 'a -> 'a store * 'a rref
Sourceval get : 'a store -> 'a rref -> 'a store * 'a
Sourceval set : 'a store -> 'a rref -> 'a -> 'a store
Sourceval 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.

Sourceval tentatively : 'a store -> (unit -> 'b) -> 'b