package opam-format

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

A key will be in the union of m1 and m2 if it is appears either m1 or m2, with the corresponding value. If a key appears in both m1 and m2, then the resulting value is built using the function given as argument.

val is_singleton : 'a t -> bool
val of_list : (key * 'a) list -> 'a t
val safe_add : key -> 'a -> 'a t -> 'a t

Raises Failure in case the element is already present

val update : key -> ('a -> 'a) -> 'a -> 'a t -> 'a t

update k f zero map updates the binding of k in map using function f, applied to the current value bound to k or zero if none

val map_reduce : ?default:'b -> (key -> 'a -> 'b) -> ('b -> 'b -> 'b) -> 'a t -> 'b

map_reduce f op t applies f to every binding of t and combines the results using associative operator op. Raises Invalid_argument on an empty map, or returns default if it is defined.

OCaml

Innovation. Community. Security.