Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file import0.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362(* 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='aCaml.ref={mutablecontents:'a}(* Reshuffle [Caml] so that we choose the modules using labels when available. *)moduleCaml=structincludeCamlmoduleArg=Caml.Arg(** @canonical Caml.Arg *)moduleArray=Caml.StdLabels.Array(** @canonical Caml.StdLabels.Array *)moduleBool=Caml.Bool(** @canonical Caml.Bool *)moduleBuffer=Caml.Buffer(** @canonical Caml.Buffer *)moduleBytes=Caml.StdLabels.Bytes(** @canonical Caml.StdLabels.Bytes *)moduleChar=Caml.Char(** @canonical Caml.Char *)moduleEphemeron=Caml.Ephemeron(** @canonical Caml.Ephemeron *)moduleFloat=Caml.Float(** @canonical Caml.Float *)moduleFormat=Caml.Format(** @canonical Caml.Format *)moduleFun=Caml.Fun(** @canonical Caml.Fun *)moduleGc=Caml.Gc(** @canonical Caml.Gc *)moduleHashtbl=Caml.MoreLabels.Hashtbl(** @canonical Caml.MoreLabels.Hashtbl *)moduleInt32=Caml.Int32(** @canonical Caml.Int32 *)moduleInt=Caml.Int(** @canonical Caml.Int *)moduleInt64=Caml.Int64(** @canonical Caml.Int64 *)moduleLazy=Caml.Lazy(** @canonical Caml.Lazy *)moduleLexing=Caml.Lexing(** @canonical Caml.Lexing *)moduleList=Caml.StdLabels.List(** @canonical Caml.StdLabels.List *)moduleMap=Caml.MoreLabels.Map(** @canonical Caml.MoreLabels.Map *)moduleNativeint=Caml.Nativeint(** @canonical Caml.Nativeint *)moduleObj=Caml.Obj(** @canonical Caml.Obj *)moduleOption=Caml.Option(** @canonical Caml.Option *)moduleParsing=Caml.Parsing(** @canonical Caml.Parsing *)modulePrintexc=Caml.Printexc(** @canonical Caml.Printexc *)modulePrintf=Caml.Printf(** @canonical Caml.Printf *)moduleQueue=Caml.Queue(** @canonical Caml.Queue *)moduleRandom=Caml.Random(** @canonical Caml.Random *)moduleResult=Caml.Result(** @canonical Caml.Result *)moduleScanf=Caml.Scanf(** @canonical Caml.Scanf *)moduleSeq=Caml.Seq(** @canonical Caml.Seq *)moduleSet=Caml.MoreLabels.Set(** @canonical Caml.MoreLabels.Set *)moduleStack=Caml.Stack(** @canonical Caml.Stack *)moduleString=Caml.StdLabels.String(** @canonical Caml.StdLabels.String *)moduleSys=Caml.Sys(** @canonical Caml.Sys *)moduleUchar=Caml.Uchar(** @canonical Caml.Uchar *)moduleUnit=Caml.Unit(** @canonical Caml.Unit *)exceptionNot_found=Caml.Not_foundendexternal(|>):'a->('a->'b)->'b="%revapply"(* These need to be declared as an external to get the lazy behavior *)external(&&):bool->bool->bool="%sequand"external(||):bool->bool->bool="%sequor"externalnot:bool->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=Caml.Obj.magicx(* This need to be declared as an external for the warnings to work properly *)externalignore:_->unit="%ignore"let(!=)=Caml.(!=)let(*)=Caml.(*)let(**)=Caml.(**)let(*.)=Caml.(*.)let(+)=Caml.(+)let(+.)=Caml.(+.)let(-)=Caml.(-)let(-.)=Caml.(-.)let(/)=Caml.(/)let(/.)=Caml.(/.)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->int->bool="%equal"external(<>):int->int->bool="%notequal"external(<):int->int->bool="%lessthan"external(>):int->int->bool="%greaterthan"external(<=):int->int->bool="%lessequal"external(>=):int->int->bool="%greaterequal"externalcompare:int->int->int="%compare"externalequal:int->int->bool="%equal"letascending(x:int)y=comparexyletdescending(x:int)y=compareyxletmax(x:int)y=ifx>=ythenxelseyletmin(x:int)y=ifx<=ythenxelseyendincludeInt_replace_polymorphic_comparemoduleInt32_replace_polymorphic_compare=structlet(<)(x:Caml.Int32.t)y=Poly.(<)xylet(<=)(x:Caml.Int32.t)y=Poly.(<=)xylet(<>)(x:Caml.Int32.t)y=Poly.(<>)xylet(=)(x:Caml.Int32.t)y=Poly.(=)xylet(>)(x:Caml.Int32.t)y=Poly.(>)xylet(>=)(x:Caml.Int32.t)y=Poly.(>=)xyletascending(x:Caml.Int32.t)y=Poly.ascendingxyletdescending(x:Caml.Int32.t)y=Poly.descendingxyletcompare(x:Caml.Int32.t)y=Poly.comparexyletequal(x:Caml.Int32.t)y=Poly.equalxyletmax(x:Caml.Int32.t)y=ifx>=ythenxelseyletmin(x:Caml.Int32.t)y=ifx<=ythenxelseyendmoduleInt64_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(=):Caml.Int64.t->Caml.Int64.t->bool="%equal"external(<>):Caml.Int64.t->Caml.Int64.t->bool="%notequal"external(<):Caml.Int64.t->Caml.Int64.t->bool="%lessthan"external(>):Caml.Int64.t->Caml.Int64.t->bool="%greaterthan"external(<=):Caml.Int64.t->Caml.Int64.t->bool="%lessequal"external(>=):Caml.Int64.t->Caml.Int64.t->bool="%greaterequal"externalcompare:Caml.Int64.t->Caml.Int64.t->int="%compare"externalequal:Caml.Int64.t->Caml.Int64.t->bool="%equal"letascending(x:Caml.Int64.t)y=Poly.ascendingxyletdescending(x:Caml.Int64.t)y=Poly.descendingxyletmax(x:Caml.Int64.t)y=ifx>=ythenxelseyletmin(x:Caml.Int64.t)y=ifx<=ythenxelseyendmoduleNativeint_replace_polymorphic_compare=structlet(<)(x:Caml.Nativeint.t)y=Poly.(<)xylet(<=)(x:Caml.Nativeint.t)y=Poly.(<=)xylet(<>)(x:Caml.Nativeint.t)y=Poly.(<>)xylet(=)(x:Caml.Nativeint.t)y=Poly.(=)xylet(>)(x:Caml.Nativeint.t)y=Poly.(>)xylet(>=)(x:Caml.Nativeint.t)y=Poly.(>=)xyletascending(x:Caml.Nativeint.t)y=Poly.ascendingxyletdescending(x:Caml.Nativeint.t)y=Poly.descendingxyletcompare(x:Caml.Nativeint.t)y=Poly.comparexyletequal(x:Caml.Nativeint.t)y=Poly.equalxyletmax(x:Caml.Nativeint.t)y=ifx>=ythenxelseyletmin(x:Caml.Nativeint.t)y=ifx<=ythenxelseyendmoduleBool_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=ifx>=ythenxelseyletmin(x:bool)y=ifx<=ythenxelseyendmoduleChar_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=ifx>=ythenxelseyletmin(x:char)y=ifx<=ythenxelseyendmoduleUchar_replace_polymorphic_compare=structletix=Caml.Uchar.to_intxlet(<)(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.(<)(ix)(iy)let(<=)(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.(<=)(ix)(iy)let(<>)(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.(<>)(ix)(iy)let(=)(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.(=)(ix)(iy)let(>)(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.(>)(ix)(iy)let(>=)(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.(>=)(ix)(iy)letascending(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.ascending(ix)(iy);;letdescending(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.descending(ix)(iy);;letcompare(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.compare(ix)(iy)letequal(x:Caml.Uchar.t)y=Int_replace_polymorphic_compare.equal(ix)(iy)letmax(x:Caml.Uchar.t)y=ifx>=ythenxelseyletmin(x:Caml.Uchar.t)y=ifx<=ythenxelseyendmoduleFloat_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=ifx>=ythenxelseyletmin(x:float)y=ifx<=ythenxelseyendmoduleString_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=ifx>=ythenxelseyletmin(x:string)y=ifx<=ythenxelseyendmoduleBytes_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=ifx>=ythenxelseyletmin(x:bytes)y=ifx<=ythenxelseyend(* This needs to be defined as an external so that the compiler can specialize it as a
direct set or caml_modify *)external(:=):'aref->'a->unit="%setfield0"(* These need to be defined as an external otherwise the compiler won't unbox
references *)external(!):'aref->'a="%field0"externalref:'a->'aref="%makemutable"let(@)=Caml.(@)let(^)=Caml.(^)let(~-)=Caml.(~-)let(~-.)=Caml.(~-.)let(asr)=Caml.(asr)let(land)=Caml.(land)letlnot=Caml.lnotlet(lor)=Caml.(lor)let(lsl)=Caml.(lsl)let(lsr)=Caml.(lsr)let(lxor)=Caml.(lxor)let(mod)=Caml.(mod)letabs=Caml.absletfailwith=Caml.failwithletfst=Caml.fstletinvalid_arg=Caml.invalid_argletsnd=Caml.snd(* [raise] needs to be defined as an external as the compiler automatically replaces
'%raise' by '%reraise' when appropriate. *)externalraise:exn->_="%raise"letphys_equal=Caml.(==)letdecr=Caml.decrletincr=Caml.incr(* used by sexp_conv, which float0 depends on through option *)letfloat_of_string=Caml.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()