1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768(**************************************************************************)(* *)(* OCaml *)(* *)(* Gabriel Scherer, projet Parsifal, INRIA Saclay *)(* *)(* Copyright 2019 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)type('a,'b)t=##V>=4.12##('a,'b)Stdlib.Either.t=Leftof'a|Rightof'b(**)letleft v=Leftvletrightv=Rightvletis_left=function|Left_->true|Right_->falseletis_right=function|Left_->false|Right_->trueletfind_left=function|Leftv->Somev|Right_->Noneletfind_right=function|Left_->None|Rightv->Somevletmap_leftf=function|Leftv->Left(fv)|Right_ase->eletmap_rightf=function|Left_ase->e|Rightv->Right(fv)letmap~left~right=function|Leftv->Left(leftv)|Rightv->Right(rightv)letfold~left~right=function|Leftv->leftv|Rightv->rightvletiter=foldletfor_all=foldletequal~left~right e1e2 =match e1,e2with|Leftv1,Leftv2->leftv1v2|Right v1,Rightv2-> rightv1v2|Left_,Right _|Right_,Left_->falseletcompare~left~righte1e2 =match e1,e2with|Leftv1,Leftv2->leftv1v2|Right v1,Rightv2-> rightv1v2|Left_,Right _->(-1)|Right_,Left_->1