123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869(* This file is free software, part of containers. See file "license" for more details. *)type'aiter=('a->unit)->unittype'aequal='a->'a->booltype'aord='a->'a->inttype'aprinter=Format.formatter->'a->unit(** {2 Basics} *)type('a,'b)t=('a,'b)Either.t=|Leftof'a|Rightof'bletleftl=Leftlletrightr=Rightrletis_left=function|Left_->true|Right_->falseletis_right=function|Left_->false|Right_->trueletfind_left=function|Leftl->Somel|Right_->Noneletfind_right=function|Left_->None|Rightr->Somerletmap_leftf=function|Leftl->Left(fl)|Rightr->Rightrletmap_rightf=function|Leftl->Leftl|Rightr->Right(fr)letmap~left~right=function|Leftl->Left(leftl)|Rightr->Right(rightr)letfold~left~right=function|Leftl->leftl|Rightr->rightrletiter=foldletfor_all=foldletequal~left~righte1e2=matche1,e2with|Leftl1,Leftl2->leftl1l2|Rightr1,Rightr2->rightr1r2|_->falseletcompare~left~righte1e2=matche1,e2with|Left_,Right_->-1|Right_,Left_->1|Leftl1,Leftl2->leftl1l2|Rightr1,Rightr2->rightr1r2(** {2 IO} *)letpp~left~rightfmt=function|Leftl->Format.fprintffmt"Left@ (@[%a@])"leftl|Rightr->Format.fprintffmt"Right@ (@[%a@])"rightr