package jhupllib

  1. Overview
  2. Docs

Module Jhupllib_witness_protection.MakeSource

A functor which creates witness registries.

Parameters

module S : Spec

Signature

Sourcetype t

The type of a witness registry.

Sourcetype elt = S.t

The type of elements stored in the registry.

Sourcetype witness

The type of a witness in the registry.

Sourceval 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.

Sourceval 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.

Sourceval 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.

Sourceval equal_witness : witness -> witness -> bool

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

Sourceval 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.