Parameter Make.1-X
Generic hashconsing signature
Given an equivalence relation eq, a hashconsing function is a function that associates the same canonical element to two elements related by eq. Usually, the element chosen is canonical w.r.t. physical equality (==), so as to reduce memory consumption and enhance efficiency of equality tests.
In order to ensure canonicality, we need a way to remember the element associated to a class of equivalence; this is done using the table type generated by the Make functor.
type uType of hashcons functions for the sub-structures contained in
t. Usually a tuple of functions.
val hashcons : u -> t -> tThe actual hashconsing function, using its fist argument to recursively hashcons substructures. It should be compatible with
eq, that iseq x (hashcons f x) = true.
val eq : t -> t -> boolA comparison function. It is allowed to use physical equality on the sub-terms hashconsed by the
hashconsfunction, but it should be insensible to shallow copy of the compared object.
val hash : t -> intA hash function passed to the underlying hashtable structure.
hashshould be compatible witheq, i.e. ifeq x y = truethenhash x = hash y.