12345678910111213141516171819202122232425262728293031323334353637383940414243(**************************************************************************)(* *)(* OCaml *)(* *)(* The OCaml programmers *)(* *)(* Copyright 2018 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'at='aoption=None|Someof'aletnone=Noneletsomev=Somevletvalueo~default=matchowithSomev->v|None->defaultletget=functionSomev->v|None->invalid_arg"option is None"letbindof=matchowithNone->None|Somev->fvletjoin=functionSomeo->o|None->Noneletmapfo=matchowithNone->None|Somev->Some(fv)letfold~none~some=functionSomev->somev|None->noneletiterf=functionSomev->fv|None->()letis_none=functionNone->true|Some_->falseletis_some=functionNone->false|Some_->trueletequaleqo0o1=matcho0,o1with|Somev0,Somev1->eqv0v1|None,None->true|_->falseletcomparecmpo0o1=matcho0,o1with|Somev0,Somev1->cmpv0v1|None,None->0|None,Some_->-1|Some_,None->1letto_result~none=functionNone->Errornone|Somev->Okvletto_list=functionNone->[]|Somev->[v]letto_seq=functionNone->Seq.empty|Somev->Seq.returnv