12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667(* 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