package jhupllib

  1. Overview
  2. Docs

A functor which creates witness registries.

Parameters

module S : Spec

Signature

type t

The type of a witness registry.

type elt = S.t

The type of elements stored in the registry.

type witness

The type of a witness in the registry.

val empty_registry : unit -> t

A function to produce an empty witness registry. Registries use mutable data structures to cache results, so each empty registry must be created separately.

val witness_of : t -> elt -> witness

Obtains a witness for the provided value. If the value already has a witness, it is returned; otherwise, a new witness is created and returned. If the same element is added to two different registries, it will not be given the same witness for each.

val element_of : t -> witness -> elt

Obtains a value for the provided witness. Raises Not_found if no such witness is stored in the provided registry.

val equal_witness : witness -> witness -> bool

Determines if two witnesses are equal. Two witnesses are equal only if they witness the same value.

val compare_witness : witness -> witness -> int

Compares two witnesses. This comparison operation is arbitrary; although the element type must be comparable, there is no guarantee of a connection between the comparison of elements and the comparison of their witnesses.

OCaml

Innovation. Community. Security.