module Univ_map:sig
..end
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
find
is no longer partial
module With_fold:sig
..end
module Multi:sig
..end
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.find
is no longer partial