Module Instrument.Map

Instrument maps.

Instrument maps

type key = t
include Stdlib.Map.S with type key := t
type !+'a t
val empty : 'a t
val is_empty : 'a t -> bool
val mem : t -> 'a t -> bool
val add : t -> 'a -> 'a t -> 'a t
val update : t -> ( 'a option -> 'a option ) -> 'a t -> 'a t
val singleton : t -> 'a -> 'a t
val remove : t -> 'a t -> 'a t
val merge : ( t -> 'a option -> 'b option -> 'c option ) -> 'a t -> 'b t -> 'c t
val union : ( t -> 'a -> 'a -> 'a option ) -> 'a t -> 'a t -> 'a t
val compare : ( 'a -> 'a -> int ) -> 'a t -> 'a t -> int
val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool
val iter : ( t -> 'a -> unit ) -> 'a t -> unit
val fold : ( t -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val for_all : ( t -> 'a -> bool ) -> 'a t -> bool
val exists : ( t -> 'a -> bool ) -> 'a t -> bool
val filter : ( t -> 'a -> bool ) -> 'a t -> 'a t
val filter_map : ( t -> 'a -> 'b option ) -> 'a t -> 'b t
val partition : ( t -> 'a -> bool ) -> 'a t -> 'a t * 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (t * 'a) list
val min_binding : 'a t -> t * 'a
val min_binding_opt : 'a t -> (t * 'a) option
val max_binding : 'a t -> t * 'a
val max_binding_opt : 'a t -> (t * 'a) option
val choose : 'a t -> t * 'a
val choose_opt : 'a t -> (t * 'a) option
val split : t -> 'a t -> 'a t * 'a option * 'a t
val find : t -> 'a t -> 'a
val find_opt : t -> 'a t -> 'a option
val find_first : ( t -> bool ) -> 'a t -> t * 'a
val find_first_opt : ( t -> bool ) -> 'a t -> (t * 'a) option
val find_last : ( t -> bool ) -> 'a t -> t * 'a
val find_last_opt : ( t -> bool ) -> 'a t -> (t * 'a) option
val map : ( 'a -> 'b ) -> 'a t -> 'b t
val mapi : ( t -> 'a -> 'b ) -> 'a t -> 'b t
val to_seq : 'a t -> (t * 'a) Stdlib.Seq.t
val to_rev_seq : 'a t -> (t * 'a) Stdlib.Seq.t
val to_seq_from : t -> 'a t -> (t * 'a) Stdlib.Seq.t
val add_seq : (t * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val of_seq : (t * 'a) Stdlib.Seq.t -> 'a t

Additionals adds

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add k v m is m with k mapping to l such that l is v :: find k m if k was bound in m and [v] otherwise.

val add_to_set : (module Stdlib.Set.S with type elt = 'a and type t = 'set) -> key -> 'a -> 'set t -> 'set t

add (module S) k v m is m with k mapping to s such that s is S.add v (find k m) if k was bound in m and S.singleton [v] otherwise.