(***********************************************************************) (* *) (* TAToo *) (* *) (* Kim Nguyen, LRI UMR8623 *) (* Université Paris-Sud & CNRS *) (* *) (* Copyright 2010-2012 Université Paris-Sud and Centre National de la *) (* Recherche Scientifique. All rights reserved. This file is *) (* distributed under the terms of the GNU Lesser General Public *) (* License, with the special exception on linking described in file *) (* ../LICENSE. *) (* *) (***********************************************************************) (** Abstract signature of a module implementing an hashconsed datatype *) module type Abstract = sig (** The type of the data to be hash-consed *) type data (** The type of hashconsed data *) type t (** [make v] internalizes the value [v], making it an hashconsed value. *) val make : data -> t (** [node h] extract the original data from its hashconsed value *) val node : t -> data (** [hash h] returns a hash of [h], such that for every [h1] and [h2], [equal h1 h2] implies [hash h1 = hash h2]. *) val hash : t -> int (** [uid h] returns a unique identifier *) val uid : t -> Uid.t (** Equality between hashconsed values. Equivalent to [==] *) val equal : t -> t -> bool (** Initializes the internal storage. Any previously hashconsed element is discarded. *) val init : unit -> unit (** Create a dummy (non-hashconsed) node with a boggus identifer and hash *) val dummy : data -> t end (** Concrete signature of a module implementing an hashconsed datatype *) module type S = sig type data type t = private { id : Uid.t; hash : int; node : data } include Abstract with type data := data and type t := t end