Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file import0.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330(* This module is included in [Import]. It is aimed at modules that define the standard
combinators for [sexp_of], [of_sexp], [compare] and [hash] and are included in
[Import]. *)include(Shadow_stdlib:moduletypeofstructincludeShadow_stdlibendwithtype'aref:='arefwithtype('a,'b,'c)format:=('a,'b,'c)formatwithtype('a,'b,'c,'d)format4:=('a,'b,'c,'d)format4withtype('a,'b,'c,'d,'e,'f)format6:=('a,'b,'c,'d,'e,'f)format6(* These modules are redefined in Base *)withmoduleArray:=Shadow_stdlib.ArraywithmoduleAtomic:=Shadow_stdlib.AtomicwithmoduleBool:=Shadow_stdlib.BoolwithmoduleBuffer:=Shadow_stdlib.BufferwithmoduleBytes:=Shadow_stdlib.ByteswithmoduleChar:=Shadow_stdlib.CharwithmoduleEither:=Shadow_stdlib.EitherwithmoduleFloat:=Shadow_stdlib.FloatwithmoduleHashtbl:=Shadow_stdlib.HashtblwithmoduleInt:=Shadow_stdlib.IntwithmoduleInt32:=Shadow_stdlib.Int32withmoduleInt64:=Shadow_stdlib.Int64withmoduleLazy:=Shadow_stdlib.LazywithmoduleList:=Shadow_stdlib.ListwithmoduleMap:=Shadow_stdlib.MapwithmoduleNativeint:=Shadow_stdlib.NativeintwithmoduleOption:=Shadow_stdlib.OptionwithmodulePrintf:=Shadow_stdlib.PrintfwithmoduleQueue:=Shadow_stdlib.QueuewithmoduleRandom:=Shadow_stdlib.RandomwithmoduleResult:=Shadow_stdlib.ResultwithmoduleSet:=Shadow_stdlib.SetwithmoduleStack:=Shadow_stdlib.StackwithmoduleString:=Shadow_stdlib.StringwithmoduleSys:=Shadow_stdlib.SyswithmoduleUchar:=Shadow_stdlib.UcharwithmoduleUnit:=Shadow_stdlib.Unit)[@ocaml.warning"-3"]type'aref='aStdlib.ref={mutablecontents:'a}(* Reshuffle [Stdlib] so that we choose the modules using labels when available. *)moduleStdlib=structincludeStdlibincludeStdlib.StdLabelsincludeStdlib.MoreLabelsendexternal(|>):'a->(('a->'b)[@local_opt])->'b="%revapply"(* These need to be declared as an external to get the lazy behavior *)external(&&):(bool[@local_opt])->(bool[@local_opt])->bool="%sequand"external(||):(bool[@local_opt])->(bool[@local_opt])->bool="%sequor"externalnot:(bool[@local_opt])->bool="%boolnot"(* We use [Obj.magic] here as other implementations generate a conditional jump and the
performance difference is noticeable. *)letbool_to_int(x:bool):int=Stdlib.Obj.magicx(* This need to be declared as an external for the warnings to work properly *)externalignore:_->unit="%ignore"let(!=)=Stdlib.(!=)let(*)=Stdlib.(*)let(**)=Stdlib.(**)let(*.)=Stdlib.(*.)let(+)=Stdlib.(+)let(+.)=Stdlib.(+.)let(-)=Stdlib.(-)let(-.)=Stdlib.(-.)let(/)=Stdlib.(/)let(/.)=Stdlib.(/.)modulePoly=Poly0(** @canonical Base.Poly *)moduleInt_replace_polymorphic_compare=struct(* Declared as externals so that the compiler skips the caml_apply_X wrapping even when
compiling without cross library inlining. *)external(=):(int[@local_opt])->(int[@local_opt])->bool="%equal"external(<>):(int[@local_opt])->(int[@local_opt])->bool="%notequal"external(<):(int[@local_opt])->(int[@local_opt])->bool="%lessthan"external(>):(int[@local_opt])->(int[@local_opt])->bool="%greaterthan"external(<=):(int[@local_opt])->(int[@local_opt])->bool="%lessequal"external(>=):(int[@local_opt])->(int[@local_opt])->bool="%greaterequal"externalcompare:(int[@local_opt])->(int[@local_opt])->int="%compare"externalequal:(int[@local_opt])->(int[@local_opt])->bool="%equal"letascending(x:int)y=comparexyletdescending(x:int)y=compareyxletmax(x:int)y=Bool0.select(x>=y)xyletmin(x:int)y=Bool0.select(x<=y)xyendincludeInt_replace_polymorphic_comparemoduleInt32_replace_polymorphic_compare=structlet(<)(x:Stdlib.Int32.t)y=Poly.(<)xylet(<=)(x:Stdlib.Int32.t)y=Poly.(<=)xylet(<>)(x:Stdlib.Int32.t)y=Poly.(<>)xylet(=)(x:Stdlib.Int32.t)y=Poly.(=)xylet(>)(x:Stdlib.Int32.t)y=Poly.(>)xylet(>=)(x:Stdlib.Int32.t)y=Poly.(>=)xyletascending(x:Stdlib.Int32.t)y=Poly.ascendingxyletdescending(x:Stdlib.Int32.t)y=Poly.descendingxyletcompare(x:Stdlib.Int32.t)y=Poly.comparexyletequal(x:Stdlib.Int32.t)y=Poly.equalxyletmax(x:Stdlib.Int32.t)y=Bool0.select(x>=y)xyletmin(x:Stdlib.Int32.t)y=Bool0.select(x<=y)xyendmoduleInt64_replace_polymorphic_compare=struct(* Declared as externals so that the compiler skips the caml_apply_X wrapping even when
compiling without cross library inlining. *)external(=):(Stdlib.Int64.t[@local_opt])->(Stdlib.Int64.t[@local_opt])->bool="%equal"external(<>):(Stdlib.Int64.t[@local_opt])->(Stdlib.Int64.t[@local_opt])->bool="%notequal"external(<):(Stdlib.Int64.t[@local_opt])->(Stdlib.Int64.t[@local_opt])->bool="%lessthan"external(>):(Stdlib.Int64.t[@local_opt])->(Stdlib.Int64.t[@local_opt])->bool="%greaterthan"external(<=):(Stdlib.Int64.t[@local_opt])->(Stdlib.Int64.t[@local_opt])->bool="%lessequal"external(>=):(Stdlib.Int64.t[@local_opt])->(Stdlib.Int64.t[@local_opt])->bool="%greaterequal"externalcompare:(Stdlib.Int64.t[@local_opt])->(Stdlib.Int64.t[@local_opt])->int="%compare"externalequal:(Stdlib.Int64.t[@local_opt])->(Stdlib.Int64.t[@local_opt])->bool="%equal"letascending(x:Stdlib.Int64.t)y=Poly.ascendingxyletdescending(x:Stdlib.Int64.t)y=Poly.descendingxyletmax(x:Stdlib.Int64.t)y=Bool0.select(x>=y)xyletmin(x:Stdlib.Int64.t)y=Bool0.select(x<=y)xyendmoduleNativeint_replace_polymorphic_compare=structlet(<)(x:Stdlib.Nativeint.t)y=Poly.(<)xylet(<=)(x:Stdlib.Nativeint.t)y=Poly.(<=)xylet(<>)(x:Stdlib.Nativeint.t)y=Poly.(<>)xylet(=)(x:Stdlib.Nativeint.t)y=Poly.(=)xylet(>)(x:Stdlib.Nativeint.t)y=Poly.(>)xylet(>=)(x:Stdlib.Nativeint.t)y=Poly.(>=)xyletascending(x:Stdlib.Nativeint.t)y=Poly.ascendingxyletdescending(x:Stdlib.Nativeint.t)y=Poly.descendingxyletcompare(x:Stdlib.Nativeint.t)y=Poly.comparexyletequal(x:Stdlib.Nativeint.t)y=Poly.equalxyletmax(x:Stdlib.Nativeint.t)y=Bool0.select(x>=y)xyletmin(x:Stdlib.Nativeint.t)y=Bool0.select(x<=y)xyendmoduleBool_replace_polymorphic_compare=structlet(<)(x:bool)y=Poly.(<)xylet(<=)(x:bool)y=Poly.(<=)xylet(<>)(x:bool)y=Poly.(<>)xylet(=)(x:bool)y=Poly.(=)xylet(>)(x:bool)y=Poly.(>)xylet(>=)(x:bool)y=Poly.(>=)xyletascending(x:bool)y=Poly.ascendingxyletdescending(x:bool)y=Poly.descendingxyletcompare(x:bool)y=Poly.comparexyletequal(x:bool)y=Poly.equalxyletmax(x:bool)y=Bool0.select(x>=y)xyletmin(x:bool)y=Bool0.select(x<=y)xyendmoduleChar_replace_polymorphic_compare=structlet(<)(x:char)y=Poly.(<)xylet(<=)(x:char)y=Poly.(<=)xylet(<>)(x:char)y=Poly.(<>)xylet(=)(x:char)y=Poly.(=)xylet(>)(x:char)y=Poly.(>)xylet(>=)(x:char)y=Poly.(>=)xyletascending(x:char)y=Poly.ascendingxyletdescending(x:char)y=Poly.descendingxyletcompare(x:char)y=Poly.comparexyletequal(x:char)y=Poly.equalxyletmax(x:char)y=Bool0.select(x>=y)xyletmin(x:char)y=Bool0.select(x<=y)xyendmoduleUchar_replace_polymorphic_compare=structletix=Stdlib.Uchar.to_intxlet(<)(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.(<)(ix)(iy)let(<=)(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.(<=)(ix)(iy)let(<>)(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.(<>)(ix)(iy)let(=)(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.(=)(ix)(iy)let(>)(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.(>)(ix)(iy)let(>=)(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.(>=)(ix)(iy)letascending(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.ascending(ix)(iy);;letdescending(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.descending(ix)(iy);;letcompare(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.compare(ix)(iy)letequal(x:Stdlib.Uchar.t)y=Int_replace_polymorphic_compare.equal(ix)(iy)letmax(x:Stdlib.Uchar.t)y=Bool0.select(x>=y)xyletmin(x:Stdlib.Uchar.t)y=Bool0.select(x<=y)xyendmoduleFloat_replace_polymorphic_compare=structlet(<)(x:float)y=Poly.(<)xylet(<=)(x:float)y=Poly.(<=)xylet(<>)(x:float)y=Poly.(<>)xylet(=)(x:float)y=Poly.(=)xylet(>)(x:float)y=Poly.(>)xylet(>=)(x:float)y=Poly.(>=)xyletascending(x:float)y=Poly.ascendingxyletdescending(x:float)y=Poly.descendingxyletcompare(x:float)y=Poly.comparexyletequal(x:float)y=Poly.equalxyletmax(x:float)y=Bool0.select(x>=y)xyletmin(x:float)y=Bool0.select(x<=y)xyendmoduleString_replace_polymorphic_compare=structlet(<)(x:string)y=Poly.(<)xylet(<=)(x:string)y=Poly.(<=)xylet(<>)(x:string)y=Poly.(<>)xylet(=)(x:string)y=Poly.(=)xylet(>)(x:string)y=Poly.(>)xylet(>=)(x:string)y=Poly.(>=)xyletascending(x:string)y=Poly.ascendingxyletdescending(x:string)y=Poly.descendingxyletcompare(x:string)y=Poly.comparexyletequal(x:string)y=Poly.equalxyletmax(x:string)y=Bool0.select(x>=y)xyletmin(x:string)y=Bool0.select(x<=y)xyendmoduleBytes_replace_polymorphic_compare=structlet(<)(x:bytes)y=Poly.(<)xylet(<=)(x:bytes)y=Poly.(<=)xylet(<>)(x:bytes)y=Poly.(<>)xylet(=)(x:bytes)y=Poly.(=)xylet(>)(x:bytes)y=Poly.(>)xylet(>=)(x:bytes)y=Poly.(>=)xyletascending(x:bytes)y=Poly.ascendingxyletdescending(x:bytes)y=Poly.descendingxyletcompare(x:bytes)y=Poly.comparexyletequal(x:bytes)y=Poly.equalxyletmax(x:bytes)y=Bool0.select(x>=y)xyletmin(x:bytes)y=Bool0.select(x<=y)xyend(* This needs to be defined as an external so that the compiler can specialize it as a
direct set or caml_modify *)external(:=):('aref[@local_opt])->'a->unit="%setfield0"(* These need to be defined as an external otherwise the compiler won't unbox
references *)external(!):('aref[@local_opt])->'a="%field0"externalref:'a->('aref[@local_opt])="%makemutable"let(@)=Stdlib.(@)let(^)=Stdlib.(^)let(~-)=Stdlib.(~-)let(~-.)=Stdlib.(~-.)let(asr)=Stdlib.(asr)let(land)=Stdlib.(land)letlnot=Stdlib.lnotlet(lor)=Stdlib.(lor)let(lsl)=Stdlib.(lsl)let(lsr)=Stdlib.(lsr)let(lxor)=Stdlib.(lxor)let(mod)=Stdlib.(mod)letabs=Stdlib.absletfailwith=Stdlib.failwithletfst=Stdlib.fstletinvalid_arg=Stdlib.invalid_argletsnd=Stdlib.snd(* [raise] needs to be defined as an external as the compiler automatically replaces
'%raise' by '%reraise' when appropriate. *)externalraise:exn->_="%raise"letphys_equal=Stdlib.(==)externaldecr:(intref[@local_opt])->unit="%decr"externalincr:(intref[@local_opt])->unit="%incr"(* used by sexp_conv, which float0 depends on through option *)letfloat_of_string=Stdlib.float_of_string(* [am_testing] is used in a few places to behave differently when in testing mode, such
as in [random.ml]. [am_testing] is implemented using [Base_am_testing], a weak C/js
primitive that returns [false], but when linking an inline-test-runner executable, is
overridden by another primitive that returns [true]. *)externalam_testing:unit->bool="Base_am_testing"letam_testing=am_testing()