package hc

  1. Overview
  2. Docs

Hash-consing library.

The implementation is based on the paper Type-Safe Modular Hash-Consing by Jean-Christophe-Filliâtre and Sylvain Conchon.

type +'a hash_consed = private {
  1. node : 'a;
  2. tag : int;
}

The type of hash-consed values. The node field is the actual value and tag is a unique integer identifier.

module type S = sig ... end

The output signature of the various functors Make, MakeStrong, Fake and Mk.

module Make (H : Hashtbl.HashedType) : S with type key = H.t

Hash-consing module using Ephemeron.K1.Make as a back-end cache.

module MakeStrong (H : Hashtbl.HashedType) : S with type key = H.t

Hash-consing module using Hashtbl.Make as a back-end cache.

module Fake (H : Hashtbl.HashedType) : S with type key = H.t

Hash-consing module that does not perform hash-consing. This is useful to easily benchmark the impact of hash-consing without having to change your code too much: simply replace Make or Makestrong by Fake.

val get_initial_cache_size : unit -> int

The size that will be used to create a cache.

val set_initial_cache_size : int -> unit

Change the size that will be used to create a cache.

val reset_initial_cache_size : unit -> unit

Reset the size that will be used to create a cache to its default value.

module type Cache = sig ... end

The type of custom cache modules.

module Mk (Cache : Cache) : S with type key = Cache.key

Hash-consing module using a custom user-defined cache.

OCaml

Innovation. Community. Security.