123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240openBasemoduletypeS=sigtype(_,_)higher_kindedtype'attypewitness1type'awitness=('a,witness1)higher_kindedvalinject:'at->'awitnessvalproject:'awitness->'atendmoduletypeS2=sigtype(_,_)higher_kindedtype('a,'z)ttypewitness2type'zwitness1=('z,witness2)higher_kindedtype('a,'z)witness=('a,'zwitness1)higher_kindedvalinject:('a,'z)t->('a,'z)witnessvalproject:('a,'z)witness->('a,'z)tendmoduletypeS3=sigtype(_,_)higher_kindedtype('a,'y,'z)ttypewitness3type'zwitness2=('z,witness3)higher_kindedtype('y,'z)witness1=('y,'zwitness2)higher_kindedtype('a,'y,'z)witness=('a,('y,'z)witness1)higher_kindedvalinject:('a,'y,'z)t->('a,'y,'z)witnessvalproject:('a,'y,'z)witness->('a,'y,'z)tendmoduletypeS4=sigtype(_,_)higher_kindedtype('a,'x,'y,'z)ttypewitness4type'zwitness3=('z,witness4)higher_kindedtype('y,'z)witness2=('y,'zwitness3)higher_kindedtype('x,'y,'z)witness1=('x,('y,'z)witness2)higher_kindedtype('a,'x,'y,'z)witness=('a,('x,'y,'z)witness1)higher_kindedvalinject:('a,'x,'y,'z)t->('a,'x,'y,'z)witnessvalproject:('a,'x,'y,'z)witness->('a,'x,'y,'z)tendmoduletypeS5=sigtype(_,_)higher_kindedtype('a,'w,'x,'y,'z)ttypewitness5type'zwitness4=('z,witness5)higher_kindedtype('y,'z)witness3=('y,'zwitness4)higher_kindedtype('x,'y,'z)witness2=('x,('y,'z)witness3)higher_kindedtype('a,'x,'y,'z)witness1=('a,('x,'y,'z)witness2)higher_kindedtype('a,'w,'x,'y,'z)witness=('a,('w,'x,'y,'z)witness1)higher_kindedvalinject:('a,'w,'x,'y,'z)t->('a,'w,'x,'y,'z)witnessvalproject:('a,'w,'x,'y,'z)witness->('a,'w,'x,'y,'z)tendmoduletypeS6=sigtype(_,_)higher_kindedtype('a,'v,'w,'x,'y,'z)ttypewitness6type'zwitness5=('z,witness6)higher_kindedtype('y,'z)witness4=('y,'zwitness5)higher_kindedtype('x,'y,'z)witness3=('x,('y,'z)witness4)higher_kindedtype('a,'x,'y,'z)witness2=('a,('x,'y,'z)witness3)higher_kindedtype('a,'w,'x,'y,'z)witness1=('a,('w,'x,'y,'z)witness2)higher_kindedtype('a,'v,'w,'x,'y,'z)witness=('a,('v,'w,'x,'y,'z)witness1)higher_kindedvalinject:('a,'v,'w,'x,'y,'z)t->('a,'v,'w,'x,'y,'z)witnessvalproject:('a,'v,'w,'x,'y,'z)witness->('a,'v,'w,'x,'y,'z)tendmoduletypeS7=sigtype(_,_)higher_kindedtype('a,'u,'v,'w,'x,'y,'z)ttypewitness7type'zwitness6=('z,witness7)higher_kindedtype('y,'z)witness5=('y,'zwitness6)higher_kindedtype('x,'y,'z)witness4=('x,('y,'z)witness5)higher_kindedtype('a,'x,'y,'z)witness3=('a,('x,'y,'z)witness4)higher_kindedtype('a,'w,'x,'y,'z)witness2=('a,('w,'x,'y,'z)witness3)higher_kindedtype('a,'v,'w,'x,'y,'z)witness1=('a,('v,'w,'x,'y,'z)witness2)higher_kindedtype('a,'u,'v,'w,'x,'y,'z)witness=('a,('u,'v,'w,'x,'y,'z)witness1)higher_kindedvalinject:('a,'u,'v,'w,'x,'y,'z)t->('a,'u,'v,'w,'x,'y,'z)witnessvalproject:('a,'u,'v,'w,'x,'y,'z)witness->('a,'u,'v,'w,'x,'y,'z)tendmoduletypeS8=sigtype(_,_)higher_kindedtype('a,'t,'u,'v,'w,'x,'y,'z)ttypewitness8type'zwitness7=('z,witness8)higher_kindedtype('y,'z)witness6=('y,'zwitness7)higher_kindedtype('x,'y,'z)witness5=('x,('y,'z)witness6)higher_kindedtype('a,'x,'y,'z)witness4=('a,('x,'y,'z)witness5)higher_kindedtype('a,'w,'x,'y,'z)witness3=('a,('w,'x,'y,'z)witness4)higher_kindedtype('a,'v,'w,'x,'y,'z)witness2=('a,('v,'w,'x,'y,'z)witness3)higher_kindedtype('a,'u,'v,'w,'x,'y,'z)witness1=('a,('u,'v,'w,'x,'y,'z)witness2)higher_kindedtype('a,'t,'u,'v,'w,'x,'y,'z)witness=('a,('t,'u,'v,'w,'x,'y,'z)witness1)higher_kindedvalinject:('a,'t,'u,'v,'w,'x,'y,'z)t->('a,'t,'u,'v,'w,'x,'y,'z)witnessvalproject:('a,'t,'u,'v,'w,'x,'y,'z)witness->('a,'t,'u,'v,'w,'x,'y,'z)tendmoduletypeHigher_kinded=sig(** This library allows you to use higher-kinded types in OCaml. See the README for a
short tutorial on what that means and how to use it. *)(** {2 Types} *)(** If [A] implements the signature [S], [(a, A.witness1) t] is equivalent to [a A.t].
*)type('a,'witness)t(** If [A] implements the signature [S2], [(a, b, A.witness2) t2] is equivalent to [(a,
b) A.t]. *)type('a,'b,'witness)t2=('a,('b,'witness)t)t(** If [A] implements the signature [S3], [(a, b, c, A.witness3) t3] is equivalent to
[(a, b, c) A.t]. *)type('a,'b,'c,'witness)t3=('a,'b,('c,'witness)t)t2(** If [A] implements the signature [S4], [(a, b, c, d, A.witness4) t4] is equivalent to
[(a, b, c, d) A.t]. *)type('a,'b,'c,'d,'witness)t4=('a,'b,'c,('d,'witness)t)t3(** If [A] implements the signature [S5], [(a, b, c, d, e, A.witness5) t5] is equivalent
to [(a, b, c, d, e) A.t]. *)type('a,'b,'c,'d,'e,'witness)t5=('a,'b,'c,'d,('e,'witness)t)t4(** If [A] implements the signature [S6], [(a, b, c, d, e, f, A.witness6) t6] is
equivalent to [(a, b, c, d, e, f) A.t]. *)type('a,'b,'c,'d,'e,'f,'witness)t6=('a,'b,'c,'d,'e,('f,'witness)t)t5(** If [A] implements the signature [S7], [(a, b, c, d, e, f, g, A.witness7) t7] is
equivalent to [(a, b, c, d, e, f, g) A.t]. *)type('a,'b,'c,'d,'e,'f,'g,'witness)t7=('a,'b,'c,'d,'e,'f,('g,'witness)t)t6(** If [A] implements the signature [S8], [(a, b, c, d, e, f, g, h, A.witness8) t8] is
equivalent to [(a, b, c, d, e, f, g, h) A.t]. *)type('a,'b,'c,'d,'e,'f,'g,'h,'witness)t8=('a,'b,'c,'d,'e,'f,'g,('h,'witness)t)t7(** {2 Signatures} *)(** These are the signatures implemented by the [Make] family of functors. *)moduletypeS=Swithtype('a,'witness)higher_kinded:=('a,'witness)tmoduletypeS2=S2withtype('a,'witness)higher_kinded:=('a,'witness)tmoduletypeS3=S3withtype('a,'witness)higher_kinded:=('a,'witness)tmoduletypeS4=S4withtype('a,'witness)higher_kinded:=('a,'witness)tmoduletypeS5=S5withtype('a,'witness)higher_kinded:=('a,'witness)tmoduletypeS6=S6withtype('a,'witness)higher_kinded:=('a,'witness)tmoduletypeS7=S7withtype('a,'witness)higher_kinded:=('a,'witness)tmoduletypeS8=S8withtype('a,'witness)higher_kinded:=('a,'witness)t(** {2 Functors} *)(** This is the meat of the library. Use these functors to implement the higher_kinded
interface. *)moduleMake(X:T1):Swithtype'at:='aX.tmoduleMake2(X:T2):S2withtype('a,'z)t:=('a,'z)X.tmoduleMake3(X:T3):S3withtype('a,'y,'z)t:=('a,'y,'z)X.tmoduleMake4(X:sigtype(_,_,_,_)tend):S4withtype('a,'x,'y,'z)t:=('a,'x,'y,'z)X.tmoduleMake5(X:sigtype(_,_,_,_,_)tend):S5withtype('a,'w,'x,'y,'z)t:=('a,'w,'x,'y,'z)X.tmoduleMake6(X:sigtype(_,_,_,_,_,_)tend):S6withtype('a,'v,'w,'x,'y,'z)t:=('a,'v,'w,'x,'y,'z)X.tmoduleMake7(X:sigtype(_,_,_,_,_,_,_)tend):S7withtype('a,'u,'v,'w,'x,'y,'z)t:=('a,'u,'v,'w,'x,'y,'z)X.tmoduleMake8(X:sigtype(_,_,_,_,_,_,_,_)tend):S8withtype('a,'t,'u,'v,'w,'x,'y,'z)t:=('a,'t,'u,'v,'w,'x,'y,'z)X.t(** {2 Implementations} *)(** [Base], [Core], and [Async] don't depend on [Higher_kinded], so we put these
implementations here instead of in the respective modules where they might have been
a nicer fit. *)moduleIdent:Swithtype'at:='amoduleArray:Swithtype'at:='aArray.tmoduleEither:S2withtype('a,'b)t:=('a,'b)Either.tmoduleHash_set:Swithtype'at:='aHash_set.tmoduleHashtbl:S2withtype('a,'b)t:=('a,'b)Hashtbl.tmoduleLazy:Swithtype'at:='aLazy.tmoduleList:Swithtype'at:='aList.tmoduleMap:S3withtype('a,'b,'c)t:=('a,'b,'c)Map.tmoduleOption:Swithtype'at:='aOption.tmoduleQueue:Swithtype'at:='aQueue.tmoduleRef:Swithtype'at:='aRef.tmoduleResult:S2withtype('a,'e)t:=('a,'e)Result.tmoduleSet:S2withtype('a,'b)t:=('a,'b)Set.tmoduleSequence:Swithtype'at:='aSequence.tmoduleType_equal:S2withtype('a,'b)t:=('a,'b)Type_equal.t(** [t] itself has two type parameters, so we might as well implement [S2] right here.
*)includeS2withtype('a,'witness)t:=('a,'witness)tend