Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file hash_set_intf.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214open!ImportmoduleKey=Hashtbl_intf.KeymoduletypeAccessors=sigincludeContainer.Generic(** override [Container.Generic.mem] *)valmem:'at->'a->bool(** preserves the equality function *)valcopy:'at->'atvaladd:'at->'a->unit(** [strict_add t x] returns [Ok ()] if the [x] was not in [t], or an [Error] if it
was. *)valstrict_add:'at->'a->unitOr_error.tvalstrict_add_exn:'at->'a->unitvalremove:'at->'a->unit(** [strict_remove t x] returns [Ok ()] if the [x] was in [t], or an [Error] if it
was not. *)valstrict_remove:'at->'a->unitOr_error.tvalstrict_remove_exn:'at->'a->unitvalclear:'at->unitvalequal:'at->'at->boolvalfilter:'at->f:('a->bool)->'atvalfilter_inplace:'at->f:('a->bool)->unit(** [inter t1 t2] computes the set intersection of [t1] and [t2]. Runs in O(min(length
t1, length t2)). Behavior is undefined if [t1] and [t2] don't have the same
equality function. *)valinter:'keyt->'keyt->'keytvalunion:'at->'at->'atvaldiff:'at->'at->'atvalof_hashtbl_keys:('a,_)Hashtbl.t->'atvalto_hashtbl:'keyt->f:('key->'data)->('key,'data)Hashtbl.tendtype('key,'z)create_options=('key,unit,'z)Hashtbl_intf.create_optionstype('key,'z)create_options_without_first_class_module=('key,unit,'z)Hashtbl_intf.create_options_without_first_class_modulemoduletypeCreators=sigtype'atvalcreate:?growth_allowed:bool(** defaults to [true] *)->?size:int(** initial size -- default 0 *)->'aKey.t->'atvalof_list:?growth_allowed:bool(** defaults to [true] *)->?size:int(** initial size -- default 0 *)->'aKey.t->'alist->'atendmoduletypeCreators_generic=sigtype'attype'aelttype('a,'z)create_optionsvalcreate:('a,unit->'at)create_optionsvalof_list:('a,'aeltlist->'at)create_optionsendmoduletypeSexp_of_m=sigtypet[@@deriving_inlinesexp_of]valsexp_of_t:t->Sexplib0.Sexp.t[@@@end]endmoduletypeM_of_sexp=sigtypet[@@deriving_inlineof_sexp]valt_of_sexp:Sexplib0.Sexp.t->t[@@@end]includeHashtbl_intf.Key.Swithtypet:=tendmoduletypeM_sexp_grammar=sigtypet[@@deriving_inlinesexp_grammar]valt_sexp_grammar:tSexplib0.Sexp_grammar.t[@@@end]endmoduletypeEqual_m=sigendmoduletypeFor_deriving=sigtype'atmoduletypeM_of_sexp=M_of_sexpmoduletypeSexp_of_m=Sexp_of_mmoduletypeEqual_m=Equal_m(** [M] is meant to be used in combination with OCaml applicative functor types:
{[
type string_hash_set = Hash_set.M(String).t
]}
which stands for:
{[
type string_hash_set = String.t Hash_set.t
]}
The point is that [Hash_set.M(String).t] supports deriving, whereas the second
syntax doesn't (because [t_of_sexp] doesn't know what comparison/hash function to
use). *)moduleM(Elt:T.T):sigtypenonrect=Elt.ttendvalsexp_of_m__t:(moduleSexp_of_mwithtypet='elt)->'eltt->Sexp.tvalm__t_of_sexp:(moduleM_of_sexpwithtypet='elt)->Sexp.t->'elttvalm__t_sexp_grammar:(moduleM_sexp_grammarwithtypet='elt)->'elttSexplib0.Sexp_grammar.tvalequal_m__t:(moduleEqual_m)->'eltt->'eltt->boolendmoduletypeHash_set=sigtype'at[@@deriving_inlinesexp_of]valsexp_of_t:('a->Sexplib0.Sexp.t)->'at->Sexplib0.Sexp.t[@@@end](** We use [[@@deriving sexp_of]] but not [[@@deriving sexp]] because we want people to be
explicit about the hash and comparison functions used when creating hashtables. One
can use [Hash_set.Poly.t], which does have [[@@deriving sexp]], to use polymorphic
comparison and hashing. *)moduleKey=KeymoduletypeCreators=CreatorsmoduletypeCreators_generic=Creators_genericmoduletypeFor_deriving=For_derivingtypenonrec('key,'z)create_options=('key,'z)create_optionsincludeCreatorswithtype'at:='at(** @open *)moduletypeAccessors=AccessorsincludeAccessorswithtype'at:='atwithtype'aelt='a(** @open *)valhashable_s:'keyt->'keyKey.ttypenonrec('key,'z)create_options_without_first_class_module=('key,'z)create_options_without_first_class_module(** A hash set that uses polymorphic comparison *)modulePoly:sigtypenonrec'at='at[@@deriving_inlinesexp,sexp_grammar]includeSexplib0.Sexpable.S1withtype'at:='atvalt_sexp_grammar:'aSexplib0.Sexp_grammar.t->'atSexplib0.Sexp_grammar.t[@@@end]includeCreators_genericwithtype'at:='atwithtype'aelt='awithtype('key,'z)create_options:=('key,'z)create_options_without_first_class_moduleincludeAccessorswithtype'at:='atwithtype'aelt:='aeltendmoduleCreators(Elt:sigtype'atvalhashable:'atHashable.tend):sigvalt_of_sexp:(Sexp.t->'aElt.t)->Sexp.t->'aElt.ttincludeCreators_genericwithtype'at:='aElt.ttwithtype'aelt:='aElt.twithtype('elt,'z)create_options:=('elt,'z)create_options_without_first_class_moduleendincludeFor_derivingwithtype'at:='at(**/**)(*_ See the Jane Street Style Guide for an explanation of [Private] submodules:
https://opensource.janestreet.com/standards/#private-submodules *)modulePrivate:sigvalhashable:'at->'aHashable.tendend