Module Hashcons

Generic hash-consing.

Hashconsing functorial interface
module type HashconsedType = sig ... end
module type S = sig ... end
module Make (X : HashconsedType) : S with type t = X.t and type u = X.u

Create a new hashconsing, given canonicalization functions.


These are intended to be used together with instances of the Make functor.

val simple_hcons : ('u -> 'tab) -> ('tab -> 't -> 't) -> 'u -> 't -> 't

simple_hcons f sub obj creates a new table each time it is applied to any sub-hash function sub.

Hashconsing of usual structures
module type HashedType = sig ... end
module Hstring : S with type t = string and type u = unit

Hashconsing of strings.

module Hlist (D : HashedType) : S with type t = D.t list and type u = D.t -> D.t

Hashconsing of lists.