123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322(* We don't just include Sexplib.Std because one can only define Hashtbl once in this
module. *)open!Import(** [include]d first so that everything else shadows it *)includeCore_pervasivesincludeInt.Replace_polymorphic_compareincludeBase_quickcheck.ExportincludeDeprecate_pipe_bangincludeEither.ExportincludeFrom_sexplibincludeInterfacesincludeList.InfixincludeNever_returnsincludeOrdering.ExportincludePerms.ExportincludeResult.Exporttype-'areturn='aWith_return.return=private{return:'b.'a->'b}[@@unboxed]includestructexceptionBugofstring[@deprecated"[since 2020-03] Don't use [Bug]"][@@derivingsexp]end[@@alert"-deprecated"](** Raised if malloc in C bindings fail (errno * size). *)exceptionC_malloc_exnofint*int(* errno, size *)let()=Callback.register_exception"C_malloc_exn"(C_malloc_exn(0,0))exceptionFinally=Exn.Finallyletfst3(x,_,_)=xletsnd3(_,y,_)=ylettrd3(_,_,z)=zinclude(structletuw=function|Somex->x|None->raiseCaml.Not_found;;end:sigvaluw:'aoption->'a[@@deprecated"[since 2018-12] Use [Option.value_exn]"]end)(** [phys_same] is like [phys_equal], but with a more general type. [phys_same] is useful
when dealing with existential types, when one has a packed value and an unpacked value
that one wants to check are physically equal. One can't use [phys_equal] in such a
situation because the types are different. *)letphys_same(typeab)(a:a)(b:b)=phys_equala(Obj.magicb:a)let(%)=Int.(%)let(/%)=Int.(/%)let(//)=Int.(//)let(==>)ab=(nota)||bletbprintf=Printf.bprintfletconst=Fn.constleteprintf=Printf.eprintfleterror=Or_error.errorleterror_s=Or_error.error_sletfailwithf=Base.Printf.failwithfinclude(structletfailwithp=(Error.failwithp[@alert"-deprecated"])end:sigvalfailwithp:?strict:unit->Source_code_position.t->string->'a->('a->Sexp.t)->_[@@deprecated"[since 2020-03] Use [failwiths] instead."]end)letfailwiths=Error.failwithsletforce=Base.Lazy.forceletfprintf=Printf.fprintfinclude(structletident=Fn.idend:sigvalident:'a->'a[@@deprecated"[since 2021-08] Use [Fn.id] instead."]end)letinvalid_argf=Base.Printf.invalid_argfletifprintf=Printf.ifprintfletis_none=Option.is_noneletis_some=Option.is_someletksprintf=Printf.ksprintfletok_exn=Or_error.ok_exnletphys_equal=Base.phys_equalletphys_same=phys_sameletprint_s=Stdio.print_sleteprint_s=Stdio.eprint_sletprintf=Printf.printfletprotect=Exn.protectletprotectx=Exn.protectxletraise_s=Error.raise_sletround=Float.roundlet(**.)=Base.(**.)let(%.)=Base.(%.)letsprintf=Printf.sprintfletstage=Staged.stageletunstage=Staged.unstageletwith_return=With_return.with_returnletwith_return_option=With_return.with_return_option(* With the following aliases, we are just making extra sure that the toplevel sexp
converters line up with the ones in our modules. *)includeTyperep_lib.Std_internalinclude(struct(* [deriving hash] is missing for [array], [bytes], and [ref] since these types are
mutable. *)type'aarray='aArray.t[@@derivingbin_io,compare,equal,sexp,sexp_grammar,typerep]typebool=Bool.t[@@derivingbin_io,compare,hash,equal,sexp,sexp_grammar,typerep]typechar=Char.t[@@derivingbin_io,compare,hash,equal,sexp,sexp_grammar,typerep]typefloat=Float.t[@@derivingbin_io,compare,hash,equal,sexp,sexp_grammar,typerep]typeint=Int.t[@@derivingbin_io,compare,hash,equal,sexp,sexp_grammar,typerep]typeint32=Int32.t[@@derivingbin_io,compare,hash,equal,sexp,sexp_grammar,typerep]typeint64=Int64.t[@@derivingbin_io,compare,hash,equal,sexp,sexp_grammar,typerep]type'alazy_t='aLazy.t[@@derivingbin_io,compare,hash,sexp,sexp_grammar,typerep]type'alist='aList.t[@@derivingbin_io,compare,hash,equal,sexp,sexp_grammar,typerep]typenativeint=Nativeint.t[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]type'aoption='aOption.t[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typestring=String.t[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typebytes=Bytes.t[@@derivingbin_io,compare,equal,sexp,sexp_grammar,typerep]type'aref='aRef.t[@@derivingbin_io,compare,equal,sexp,sexp_grammar,typerep]typeunit=Unit.t[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep](* Bin_prot has optimized functions for float arrays *)includestructtypefloat_array=floatarray[@@derivingbin_io]end[@alert"-deprecated"]include(structtypefloat_array=Float.tarray[@@derivingcompare,sexp,sexp_grammar,typerep]end:sigtypefloat_array[@@derivingcompare,sexp,sexp_grammar,typerep]endwithtypefloat_array:=float_array)end:sigtype'aarray[@@derivingbin_io,compare,equal,sexp,sexp_grammar,typerep]typebool[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typechar[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typefloat[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typeint[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typeint32[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typeint64[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]type'alazy_t[@@derivingbin_io,compare,hash,sexp,sexp_grammar,typerep]type'alist[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typenativeint[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]type'aoption[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typestring[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]typebytes[@@derivingbin_io,compare,equal,sexp,sexp_grammar,typerep]type'aref[@@derivingbin_io,compare,equal,sexp,sexp_grammar,typerep]typeunit[@@derivingbin_io,compare,equal,hash,sexp,sexp_grammar,typerep]includesigtypefloat_array=floatarray[@@derivingbin_io,compare,sexp,sexp_grammar,typerep][@@deprecated"[since 2021-09] use [float array] or [floatarray] instead"]end[@alert"-deprecated"]endwithtype'aarray:='aarraywithtypebool:=boolwithtypechar:=charwithtypefloat:=floatwithtypeint:=intwithtypeint32:=int32withtypeint64:=int64withtype'alist:='alistwithtypenativeint:=nativeintwithtype'aoption:='aoptionwithtypestring:=stringwithtypebytes:=byteswithtype'alazy_t:='alazy_twithtype'aref:='arefwithtypeunit:=unit)letsexp_of_exn=Exn.sexp_of_t(* The code below checks that the signatures in map.mli and set.mli are
consistent with the generic map and set signatures defined in map_intf.ml
and set_intf.ml. *)let()=letmoduleT=structtype'aelt='atype'acmp='aendinletmodule_:sigopenSet_intfmoduleTree:sigtype('a,'b)tincludeCreators_and_accessors2_with_comparatorwithtype('a,'b)set:=('a,'b)twithtype('a,'b)t:=('a,'b)twithtype('a,'b)tree:=('a,'b)twithtype('a,'b)named:=('a,'b)Tree.Named.tendtype('a,'b)tincludeAccessors2withtype('a,'b)t:=('a,'b)twithtype('a,'b)tree:=('a,'b)Tree.twithtype('a,'b)named:=('a,'b)Named.tincludeCreators_genericwithtype('a,'b)set:=('a,'b)twithtype('a,'b)t:=('a,'b)twithtype('a,'b)tree:=('a,'b)Tree.twithtype'aelt:='aT.eltwithtype'acmp:='aT.cmpwithtype('a,'cmp,'z)options:=('a,'cmp,'z)Set_intf.With_first_class_module.tend=Setin();;let()=letmoduleT=structtype'kkey='ktype'ccmp='cendinletmodule_:sigopenMap_intfmoduleTree:sigtype('a,'b,'c)tincludeCreators_and_accessors3_with_comparatorwithtype('a,'b,'c)t:=('a,'b,'c)twithtype('a,'b,'c)tree:=('a,'b,'c)tendtype('a,'b,'c)tincludeAccessors3withtype('a,'b,'c)t:=('a,'b,'c)twithtype('a,'b,'c)tree:=('a,'b,'c)Tree.tincludeCreators_genericwithtype('a,'b,'c)t:=('a,'b,'c)twithtype('a,'b,'c)tree:=('a,'b,'c)Tree.twithtype('a,'cmp,'z)options:=('a,'cmp,'z)Map_intf.With_first_class_module.twithtype'kkey:='kT.keywithtype'ccmp:='cT.cmpend=Mapin();;