You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.5 KiB
61 lines
1.5 KiB
(*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*)
|
|
|
|
open Import0
|
|
|
|
module type S = sig
|
|
type key
|
|
|
|
module Key : sig
|
|
type t = key
|
|
|
|
include Comparator.S with type t := t
|
|
end
|
|
|
|
include Core_kernel.Map_intf.Make_S_plain_tree(Key).S
|
|
|
|
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
|
|
|
|
val map_endo : 'a t -> f:('a -> 'a) -> 'a t
|
|
(** Like map, but specialized to require [f] to be an endofunction, which
|
|
enables preserving [==] if [f] preserves [==] of every element. *)
|
|
|
|
val merge_endo :
|
|
'a t
|
|
-> 'b t
|
|
-> f:
|
|
( key:key
|
|
-> [`Both of 'a * 'b | `Left of 'a | `Right of 'b]
|
|
-> 'a option)
|
|
-> 'a t
|
|
(** Like merge, but specialized to require [f] to preserve the type of the
|
|
left argument, which enables preserving [==] if [f] preserves [==] of
|
|
every element. *)
|
|
|
|
val merge_skewed :
|
|
'a t -> 'a t -> combine:(key:key -> 'a -> 'a -> 'a) -> 'a t
|
|
|
|
val fold_until :
|
|
'v t
|
|
-> init:'a
|
|
-> f:(key:key -> data:'v -> 'a -> ('a, 'r) Continue_or_stop.t)
|
|
-> finish:('a -> 'r)
|
|
-> 'r
|
|
|
|
val choose : 'a t -> (key * 'a) option
|
|
val pop : 'a t -> (key * 'a * 'a t) option
|
|
val find_and_remove : 'a t -> key -> ('a * 'a t) option
|
|
val pp : key pp -> 'a pp -> 'a t pp
|
|
|
|
val pp_diff :
|
|
data_equal:('a -> 'a -> bool)
|
|
-> key pp
|
|
-> 'a pp
|
|
-> ('a * 'a) pp
|
|
-> ('a t * 'a t) pp
|
|
end
|