package jhupllib

  1. Overview
  2. Docs

The type of a registry with an escort. Escorts pair the witnesses with their registries to make operations such as pretty-printing easier. This module only defines escorts and their basic comparison operations. More operations can be added by including utils modules produced by the other functors in this module.

include Registry
type t

The type of a witness registry.

type elt

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.

type escorted_witness
val witness_of_escorted_witness : escorted_witness -> witness
val registry_of_escorted_witness : escorted_witness -> t
val element_of_escorted_witness : escorted_witness -> elt
val escorted_witness_of : t -> elt -> escorted_witness
val share_escort : escorted_witness -> elt -> escorted_witness
val equal_escorted_witness : escorted_witness -> escorted_witness -> bool
val compare_escorted_witness : escorted_witness -> escorted_witness -> int