package core_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Universal/heterogeneous maps, 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.ts 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.

module Key = Type_equal.Id
module type S = Univ_map.S
module type S1 = Univ_map.S1
include S with type 'a data = 'a
type t
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
type 'a data = 'a
val invariant : t Base__.Invariant_intf.inv
val empty : t
val is_empty : t -> Base.Bool.t
val set : t -> 'a Key.t -> 'a data -> t
val mem : t -> 'a Key.t -> Base.Bool.t
val mem_by_id : t -> Key.Uid.t -> Base.Bool.t
val find : t -> 'a Key.t -> 'a data Base.Option.t
val find_exn : t -> 'a Key.t -> 'a data
val add : t -> 'a Key.t -> 'a data -> [ `Ok of t | `Duplicate ]
val add_exn : t -> 'a Key.t -> 'a data -> t
val change : t -> 'a Key.t -> f:('a data Base.Option.t -> 'a data Base.Option.t) -> t
val change_exn : t -> 'a Key.t -> f:('a data -> 'a data) -> t
val update : t -> 'a Key.t -> f:('a data Base.Option.t -> 'a data) -> t
val remove : t -> 'a Key.t -> t
val remove_by_id : t -> Key.Uid.t -> t
module Packed : sig ... end
val to_alist : t -> Packed.t Base.List.t
val of_alist_exn : Packed.t Base.List.t -> t
module Make (Data : sig ... end) : sig ... end
module Make1 (Data : sig ... end) : sig ... end
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

OCaml

Innovation. Community. Security.