This module defines interfaces used in Core.Std.Set. This module uses the same organizational approach as Core_map_intf. See the documentation in core_map.mli for a description of the approach.

This module defines module types {Creators,Accessors}{0,1,2,_generic,_with_comparator}. It uses check functors to ensure that each module types is an instance of the corresponding _generic one.

We must treat Creators and Accessors separately, because we sometimes need to choose different instantiations of their options. In particular, Set itself matches Creators2_with_comparator but Accessors2 (without comparator).

module Binable : Binable0
module type Elt = sig .. end
type t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val compare : t -> t -> int
module type Elt_binable = sig .. end
type t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val compare : t -> t -> int
val bin_t : t Bin_prot.Type_class.t
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
module Without_comparator : Core_map_intf.Without_comparator
module With_comparator : Core_map_intf.With_comparator
module type Accessors_generic = sig .. end
include Container.Generic_phantom
type ('a, 'cmp) tree
type ('a, 'cmp, 'z) options
val invariants : ('a, 'cmp, ('a, 'cmp) t -> bool) options
val mem : ('a, 'cmp, ('a, 'cmp) t -> 'a elt -> bool) options
val add : ('a, 'cmp, ('a, 'cmp) t -> 'a elt -> ('a, 'cmp) t) options
val remove : ('a, 'cmp, ('a, 'cmp) t -> 'a elt -> ('a, 'cmp) t) options
val union : ('a, 'cmp, ('a, 'cmp) t -> ('a, 'cmp) t -> ('a, 'cmp) t) options
val inter : ('a, 'cmp, ('a, 'cmp) t -> ('a, 'cmp) t -> ('a, 'cmp) t) options
val diff : ('a, 'cmp, ('a, 'cmp) t -> ('a, 'cmp) t -> ('a, 'cmp) t) options
val compare_direct : ('a, 'cmp, ('a, 'cmp) t -> ('a, 'cmp) t -> int) options
val equal : ('a, 'cmp, ('a, 'cmp) t -> ('a, 'cmp) t -> bool) options
val subset : ('a, 'cmp, ('a, 'cmp) t -> ('a, 'cmp) t -> bool) options
val fold_until : ('a, 'c) t ->
init:'b -> f:('b -> 'a elt -> [ `Continue of 'b | `Stop of 'b ]) -> 'b
val fold_right : ('a, 'c) t -> init:'b -> f:('a elt -> 'b -> 'b) -> 'b
val iter2 : ('a, 'cmp,
 ('a, 'cmp) t ->
 ('a, 'cmp) t ->
 f:([ `Both of 'a elt * 'a elt | `Left of 'a elt | `Right of 'a elt ] -> unit) ->
 unit)
options
val filter : ('a, 'cmp, ('a, 'cmp) t -> f:('a elt -> bool) -> ('a, 'cmp) t) options
val partition_tf : ('a, 'cmp, ('a, 'cmp) t -> f:('a elt -> bool) -> ('a, 'cmp) t * ('a, 'cmp) t)
options
val elements : ('a, 'b) t -> 'a elt list
val min_elt : ('a, 'b) t -> 'a elt option
val min_elt_exn : ('a, 'b) t -> 'a elt
val max_elt : ('a, 'b) t -> 'a elt option
val max_elt_exn : ('a, 'b) t -> 'a elt
val choose : ('a, 'b) t -> 'a elt option
val choose_exn : ('a, 'b) t -> 'a elt
val split : ('a, 'cmp, ('a, 'cmp) t -> 'a elt -> ('a, 'cmp) t * bool * ('a, 'cmp) t)
options
val group_by : ('a, 'cmp,
 ('a, 'cmp) t -> equiv:('a elt -> 'a elt -> bool) -> ('a, 'cmp) t list)
options
val find_exn : ('a, 'b) t -> f:('a elt -> bool) -> 'a elt
val find_index : ('a, 'b) t -> int -> 'a elt option
val remove_index : ('a, 'cmp, ('a, 'cmp) t -> int -> ('a, 'cmp) t) options
val to_tree : ('a, 'cmp) t -> ('a elt, 'cmp) tree
module type Accessors0 = sig .. end
include Container.S0
type tree
val invariants : t -> bool
val mem : t -> elt -> bool
val add : t -> elt -> t
val remove : t -> elt -> t
val union : t -> t -> t
val inter : t -> t -> t
val diff : t -> t -> t
val compare_direct : t -> t -> int
val equal : t -> t -> bool
val subset : t -> t -> bool
val fold_until : t -> init:'b -> f:('b -> elt -> [ `Continue of 'b | `Stop of 'b ]) -> 'b
val fold_right : t -> init:'b -> f:(elt -> 'b -> 'b) -> 'b
val iter2 : t ->
t ->
f:([ `Both of elt * elt | `Left of elt | `Right of elt ] -> unit) -> unit
val filter : t -> f:(elt -> bool) -> t
val partition_tf : t -> f:(elt -> bool) -> t * t
val elements : t -> elt list
val min_elt : t -> elt option
val min_elt_exn : t -> elt
val max_elt : t -> elt option
val max_elt_exn : t -> elt
val choose : t -> elt option
val choose_exn : t -> elt
val split : t -> elt -> t * bool * t
val group_by : t -> equiv:(elt -> elt -> bool) -> t list
val find_exn : t -> f:(elt -> bool) -> elt
val find_index : t -> int -> elt option
val remove_index : t -> int -> t
val to_tree : t -> tree
module type Accessors1 = sig .. end
include Container.S1
type 'a tree
val invariants : 'a t -> bool
val mem : 'a t -> 'a -> bool
val add : 'a t -> 'a -> 'a t
val remove : 'a t -> 'a -> 'a t
val union : 'a t -> 'a t -> 'a t
val inter : 'a t -> 'a t -> 'a t
val diff : 'a t -> 'a t -> 'a t
val compare_direct : 'a t -> 'a t -> int
val equal : 'a t -> 'a t -> bool
val subset : 'a t -> 'a t -> bool
val fold_until : 'a t -> init:'b -> f:('b -> 'a -> [ `Continue of 'b | `Stop of 'b ]) -> 'b
val fold_right : 'a t -> init:'b -> f:('a -> 'b -> 'b) -> 'b
val iter2 : 'a t ->
'a t -> f:([ `Both of 'a * 'a | `Left of 'a | `Right of 'a ] -> unit) -> unit
val filter : 'a t -> f:('a -> bool) -> 'a t
val partition_tf : 'a t -> f:('a -> bool) -> 'a t * 'a t
val elements : 'a t -> 'a list
val min_elt : 'a t -> 'a option
val min_elt_exn : 'a t -> 'a
val max_elt : 'a t -> 'a option
val max_elt_exn : 'a t -> 'a
val choose : 'a t -> 'a option
val choose_exn : 'a t -> 'a
val split : 'a t -> 'a -> 'a t * bool * 'a t
val group_by : 'a t -> equiv:('a -> 'a -> bool) -> 'a t list
val find_exn : 'a t -> f:('a -> bool) -> 'a
val find_index : 'a t -> int -> 'a option
val remove_index : 'a t -> int -> 'a t
val to_tree : 'a t -> 'a tree
module type Accessors2 = sig .. end
include Container.S1_phantom_invariant
type ('a, 'cmp) tree
val invariants : ('a, 'b) t -> bool
val mem : ('a, 'b) t -> 'a -> bool
val add : ('a, 'cmp) t -> 'a -> ('a, 'cmp) t
val remove : ('a, 'cmp) t -> 'a -> ('a, 'cmp) t
val union : ('a, 'cmp) t -> ('a, 'cmp) t -> ('a, 'cmp) t
val inter : ('a, 'cmp) t -> ('a, 'cmp) t -> ('a, 'cmp) t
val diff : ('a, 'cmp) t -> ('a, 'cmp) t -> ('a, 'cmp) t
val compare_direct : ('a, 'cmp) t -> ('a, 'cmp) t -> int
val equal : ('a, 'cmp) t -> ('a, 'cmp) t -> bool
val subset : ('a, 'cmp) t -> ('a, 'cmp) t -> bool
val fold_until : ('a, 'c) t ->
init:'b -> f:('b -> 'a -> [ `Continue of 'b | `Stop of 'b ]) -> 'b
val fold_right : ('a, 'c) t -> init:'b -> f:('a -> 'b -> 'b) -> 'b
val iter2 : ('a, 'cmp) t ->
('a, 'cmp) t ->
f:([ `Both of 'a * 'a | `Left of 'a | `Right of 'a ] -> unit) -> unit
val filter : ('a, 'cmp) t -> f:('a -> bool) -> ('a, 'cmp) t
val partition_tf : ('a, 'cmp) t -> f:('a -> bool) -> ('a, 'cmp) t * ('a, 'cmp) t
val elements : ('a, 'b) t -> 'a list
val min_elt : ('a, 'b) t -> 'a option
val min_elt_exn : ('a, 'b) t -> 'a
val max_elt : ('a, 'b) t -> 'a option
val max_elt_exn : ('a, 'b) t -> 'a
val choose : ('a, 'b) t -> 'a option
val choose_exn : ('a, 'b) t -> 'a
val split : ('a, 'cmp) t -> 'a -> ('a, 'cmp) t * bool * ('a, 'cmp) t
val group_by : ('a, 'cmp) t -> equiv:('a -> 'a -> bool) -> ('a, 'cmp) t list
val find_exn : ('a, 'b) t -> f:('a -> bool) -> 'a
val find_index : ('a, 'b) t -> int -> 'a option
val remove_index : ('a, 'cmp) t -> int -> ('a, 'cmp) t
val to_tree : ('a, 'cmp) t -> ('a, 'cmp) tree
module type Accessors2_with_comparator = sig .. end
include Container.S1_phantom_invariant
type ('a, 'cmp) tree
val invariants : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t -> bool
val mem : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t -> 'a -> bool
val add : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t -> 'a -> ('a, 'cmp) t
val remove : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t -> 'a -> ('a, 'cmp) t
val union : comparator:('a, 'cmp) Comparator.t ->
('a, 'cmp) t -> ('a, 'cmp) t -> ('a, 'cmp) t
val inter : comparator:('a, 'cmp) Comparator.t ->
('a, 'cmp) t -> ('a, 'cmp) t -> ('a, 'cmp) t
val diff : comparator:('a, 'cmp) Comparator.t ->
('a, 'cmp) t -> ('a, 'cmp) t -> ('a, 'cmp) t
val compare_direct : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t -> ('a, 'cmp) t -> int
val equal : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t -> ('a, 'cmp) t -> bool
val subset : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t -> ('a, 'cmp) t -> bool
val fold_until : ('a, 'b) t ->
init:'accum ->
f:('accum -> 'a -> [ `Continue of 'accum | `Stop of 'accum ]) -> 'accum
val fold_right : ('a, 'b) t -> init:'accum -> f:('a -> 'accum -> 'accum) -> 'accum
val iter2 : comparator:('a, 'cmp) Comparator.t ->
('a, 'cmp) t ->
('a, 'cmp) t ->
f:([ `Both of 'a * 'a | `Left of 'a | `Right of 'a ] -> unit) -> unit
val filter : comparator:('a, 'cmp) Comparator.t ->
('a, 'cmp) t -> f:('a -> bool) -> ('a, 'cmp) t
val partition_tf : comparator:('a, 'cmp) Comparator.t ->
('a, 'cmp) t -> f:('a -> bool) -> ('a, 'cmp) t * ('a, 'cmp) t
val elements : ('a, 'b) t -> 'a list
val min_elt : ('a, 'b) t -> 'a option
val min_elt_exn : ('a, 'b) t -> 'a
val max_elt : ('a, 'b) t -> 'a option
val max_elt_exn : ('a, 'b) t -> 'a
val choose : ('a, 'b) t -> 'a option
val choose_exn : ('a, 'b) t -> 'a
val split : comparator:('a, 'cmp) Comparator.t ->
('a, 'cmp) t -> 'a -> ('a, 'cmp) t * bool * ('a, 'cmp) t
val group_by : comparator:('a, 'cmp) Comparator.t ->
('a, 'cmp) t -> equiv:('a -> 'a -> bool) -> ('a, 'cmp) t list
val find_exn : ('a, 'b) t -> f:('a -> bool) -> 'a
val find_index : ('a, 'b) t -> int -> 'a option
val remove_index : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t -> int -> ('a, 'cmp) t
val to_tree : ('a, 'cmp) t -> ('a, 'cmp) tree
module Check_accessors : 
functor (T : T.T2) ->
functor (Tree : T.T2) ->
functor (Elt : T.T1) ->
functor (Options : T.T3) ->
functor (M : Accessors_generic with type options := ('a, 'b, 'c) Options.t with type t := ('a, 'b) T.t with type tree := ('a, 'b) Tree.t with type elt := 'a Elt.t) -> sig .. end
module Check_accessors0 : 
functor (M : Accessors0) -> Check_accessors(sig .. end)(sig .. end)(sig .. end)(Without_comparator)(M)
module Check_accessors1 : 
functor (M : Accessors1) -> Check_accessors(sig .. end)(sig .. end)(sig .. end)(Without_comparator)(M)
module Check_accessors2 : 
functor (M : Accessors2) -> Check_accessors(sig .. end)(sig .. end)(sig .. end)(Without_comparator)(M)
module Check_accessors2_with_comparator : 
functor (M : Accessors2_with_comparator) -> Check_accessors(sig .. end)(sig .. end)(sig .. end)(With_comparator)(M)
module type Creators_generic = sig .. end
type ('a, 'cmp) t
type ('a, 'cmp) set
type ('a, 'cmp) tree
type 'a elt
type ('a, 'cmp, 'z) options
val empty : ('a, 'cmp, ('a, 'cmp) t) options
val singleton : ('a, 'cmp, 'a elt -> ('a, 'cmp) t) options
val union_list : ('a, 'cmp, ('a, 'cmp) t list -> ('a, 'cmp) t) options
val of_list : ('a, 'cmp, 'a elt list -> ('a, 'cmp) t) options
val of_array : ('a, 'cmp, 'a elt array -> ('a, 'cmp) t) options
val of_sorted_array : ('a, 'cmp, 'a elt array -> ('a, 'cmp) t Or_error.t) options
val of_sorted_array_unchecked : ('a, 'cmp, 'a elt array -> ('a, 'cmp) t) options
val stable_dedup_list : ('a, 'b, 'a elt list -> 'a elt list) options
val map : ('b, 'cmp, ('a, 'c) set -> f:('a -> 'b elt) -> ('b, 'cmp) t) options
The types of map and filter_map are subtle. The input set, ('a, _) set, reflects the fact that these functions take a set of *any* type, with any comparator, while the output set, ('b, 'cmp) t, reflects that the output set has the particular 'cmp of the creation function. The comparator can come in one of three ways, depending on which set module is used
  • Set.map -- comparator comes as an argument
  • Set.Poly.map -- comparator is polymorphic comparison
  • Foo.Set.map -- comparator is Foo.comparator
val filter_map : ('b, 'cmp, ('a, 'c) set -> f:('a -> 'b elt option) -> ('b, 'cmp) t) options
val of_tree : ('a, 'cmp, ('a elt, 'cmp) tree -> ('a, 'cmp) t) options
module type Creators0 = sig .. end
type ('a, 'cmp) set
type t
type tree
type elt
val empty : t
val singleton : elt -> t
val union_list : t list -> t
val of_list : elt list -> t
val of_array : elt array -> t
val of_sorted_array : elt array -> t Or_error.t
val of_sorted_array_unchecked : elt array -> t
val stable_dedup_list : elt list -> elt list
val map : ('a, 'b) set -> f:('a -> elt) -> t
val filter_map : ('a, 'b) set -> f:('a -> elt option) -> t
val of_tree : tree -> t
module type Creators1 = sig .. end
type ('a, 'cmp) set
type 'a t
type 'a tree
val empty : 'a t
val singleton : 'a -> 'a t
val union_list : 'a t list -> 'a t
val of_list : 'a list -> 'a t
val of_array : 'a array -> 'a t
val of_sorted_array : 'a array -> 'a t Or_error.t
val of_sorted_array_unchecked : 'a array -> 'a t
val stable_dedup_list : 'a list -> 'a list
val map : ('a, 'c) set -> f:('a -> 'b) -> 'b t
val filter_map : ('a, 'c) set -> f:('a -> 'b option) -> 'b t
val of_tree : 'a tree -> 'a t
module type Creators2 = sig .. end
type ('a, 'cmp) set
type ('a, 'cmp) t
type ('a, 'cmp) tree
val empty : ('a, 'cmp) t
val singleton : 'a -> ('a, 'cmp) t
val union_list : ('a, 'cmp) t list -> ('a, 'cmp) t
val of_list : 'a list -> ('a, 'cmp) t
val of_array : 'a array -> ('a, 'cmp) t
val of_sorted_array : 'a array -> ('a, 'cmp) t Or_error.t
val of_sorted_array_unchecked : 'a array -> ('a, 'cmp) t
val stable_dedup_list : 'a list -> 'a list
val map : ('a, 'c) set -> f:('a -> 'b) -> ('b, 'cmp) t
val filter_map : ('a, 'c) set -> f:('a -> 'b option) -> ('b, 'cmp) t
val of_tree : ('a, 'cmp) tree -> ('a, 'cmp) t
module type Creators2_with_comparator = sig .. end
type ('a, 'cmp) set
type ('a, 'cmp) t
type ('a, 'cmp) tree
val empty : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t
val singleton : comparator:('a, 'cmp) Comparator.t -> 'a -> ('a, 'cmp) t
val union_list : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) t list -> ('a, 'cmp) t
val of_list : comparator:('a, 'cmp) Comparator.t -> 'a list -> ('a, 'cmp) t
val of_array : comparator:('a, 'cmp) Comparator.t -> 'a array -> ('a, 'cmp) t
val of_sorted_array : comparator:('a, 'cmp) Comparator.t -> 'a array -> ('a, 'cmp) t Or_error.t
val of_sorted_array_unchecked : comparator:('a, 'cmp) Comparator.t -> 'a array -> ('a, 'cmp) t
val stable_dedup_list : comparator:('a, 'cmp) Comparator.t -> 'a list -> 'a list
val map : comparator:('b, 'cmp) Comparator.t ->
('a, 'c) set -> f:('a -> 'b) -> ('b, 'cmp) t
val filter_map : comparator:('b, 'cmp) Comparator.t ->
('a, 'c) set -> f:('a -> 'b option) -> ('b, 'cmp) t
val of_tree : comparator:('a, 'cmp) Comparator.t -> ('a, 'cmp) tree -> ('a, 'cmp) t
module Check_creators : 
functor (T : T.T2) ->
functor (Tree : T.T2) ->
functor (Elt : T.T1) ->
functor (Options : T.T3) ->
functor (M : Creators_generic with type options := ('a, 'b, 'c) Options.t with type t := ('a, 'b) T.t with type tree := ('a, 'b) Tree.t with type elt := 'a Elt.t) -> sig .. end
module Check_creators0 : 
functor (M : Creators0) -> Check_creators(sig .. end)(sig .. end)(sig .. end)(Without_comparator)(M)
module Check_creators1 : 
functor (M : Creators1) -> Check_creators(sig .. end)(sig .. end)(sig .. end)(Without_comparator)(M)
module Check_creators2 : 
functor (M : Creators2) -> Check_creators(sig .. end)(sig .. end)(sig .. end)(Without_comparator)(M)
module Check_creators2_with_comparator : 
functor (M : Creators2_with_comparator) -> Check_creators(sig .. end)(sig .. end)(sig .. end)(With_comparator)(M)
module type Creators_and_accessors_generic = sig .. end
include Accessors_generic
include Creators_generic with type options := ('a, 'b, 'c) options with type t := ('a, 'b) t with type tree := ('a, 'b) tree with type elt := 'a elt
module type Creators_and_accessors0 = sig .. end
include Accessors0
include Creators0 with type t := t with type tree := tree with type elt := elt
module type Creators_and_accessors1 = sig .. end
include Accessors1
include Creators1 with type t := 'a t with type tree := 'a tree
module type Creators_and_accessors2 = sig .. end
include Accessors2
include Creators2 with type t := ('a, 'b) t with type tree := ('a, 'b) tree
module type Creators_and_accessors2_with_comparator = sig .. end
include Accessors2_with_comparator
include Creators2_with_comparator with type t := ('a, 'b) t with type tree := ('a, 'b) tree
module type S0 = sig .. end
type ('a, 'cmp) set
type ('a, 'cmp) tree
module Elt : sig .. end
type t
include Comparator.S with type t := t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
module Tree : sig .. end
type t = (Elt.t, Elt.comparator_witness) tree
include Creators_and_accessors0 with type set := ('a, 'b) tree with type t := t with type tree := t with type elt := Elt.t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val compare : t -> t -> int
type t = (Elt.t, Elt.comparator_witness) set
include Creators_and_accessors0 with type set := ('a, 'b) set with type t := t with type tree := Tree.t with type elt := Elt.t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val compare : t -> t -> int
module type S0_binable = sig .. end
include S0
include Binable.S with type t := t