Module Ephemeron.GenHashTable

module GenHashTable: sig .. end

Hash tables on generic containers with notion of death and aliveness.


Define a hash table on generic containers which have a notion of "death" and aliveness. If a binding is dead the hash table can automatically remove it.

type equal = 
| ETrue
| EFalse
| EDead (*

the container is dead

*)
module MakeSeeded: functor (H : sig
type t;

keys

type container('a);

contains keys and the associated data

let hash: (int, t) => int;

same as Hashtbl.SeededHashedType

let equal: (container('a), t) => Ephemeron.GenHashTable.equal;

equality predicate used to compare a key with the one in a container. Can return EDead if the keys in the container are dead

let create: (t, 'a) => container('a);

create key data creates a container from some initials keys and one data

let get_key: container('a) => option(t);

get_key cont returns the keys if they are all alive

let get_data: container('a) => option('a);

get_data cont returns the data if it is alive

let set_key_data: (container('a), t, 'a) => unit;

set_key_data cont modifies the key and data

let check_key: container('a) => bool;

check_key cont checks if all the keys contained in the data are alive

end) -> Ephemeron.SeededS  with type key = H.t

Functor building an implementation of an hash table that use the container for keeping the information given