Module Univ_map

module Univ_map: sig .. end
Universal/heterogeneous maps.

These maps are useful for storing values of arbitrary type in a single map. In order to recover a value, it must be looked up with exactly the Key.t it was stored in. In other words, given different Key.t's from the same string, one will not be able to recover the key stored in the other one.

This is similar to Univ in spirit, and is indeed built on top of Univ.


type t 
val empty : t
val is_empty : t -> bool
module Key: sig .. end
val set : t -> 'a Key.t -> 'a -> t
val mem : t -> 'a Key.t -> bool
val find : t -> 'a Key.t -> 'a option
val find_exn : t -> 'a Key.t -> 'a
val add : t -> 'a Key.t -> 'a -> [ `Duplicate | `Ok of t ]
val add_exn : t -> 'a Key.t -> 'a -> t
val change : t -> 'a Key.t -> ('a option -> 'a option) -> t
val change_exn : t -> 'a Key.t -> ('a -> 'a) -> t
module With_default: sig .. end
keys with associated default values, so that find is no longer partial
module With_fold: sig .. end
keys that map to an accumulator value with an associated fold operation
module Multi: sig .. end
list-accumulating keys with a default value of the empty list
val sexp_of_t : t -> Sexplib.Sexp.t

create name to_sexp generates a fresh key. Note: If type 'a doesn't support sexp conversion, then a good practice is to use sexp_of_opaque as the converter.

keys with associated default values, so that find is no longer partial

keys that map to an accumulator value with an associated fold operation

list-accumulating keys with a default value of the empty list