12345678910111213141516171819202122232425262728293031323334353637383940414243444546(**************************************************************************)(* *)(* OCaml *)(* *)(* Diana Kalinichenko, Jane Street, New York *)(* *)(* Copyright 2024 Jane Street Group LLC *)(* *)(* 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:value_or_nullmodeverythingwith'a='aor_null[@@or_null_reexport]letnull=Nullletthisv=Thisvletvaluet~default=matchtwithNull->default|Thisv->vletget=functionNull->invalid_arg"or_null is Null"|Thisv->vletbindtf=matchtwithNull->Null|Thisv->fvletmapft=matchtwithNull->Null|Thisv->This(fv)letfold~null~thist=matchtwithNull->null|Thisv->thisvletiterft=matchtwithNull->()|Thisv->fvletis_null=functionNull->true|This_->falseletis_this=functionNull->false|This_->trueletequaleqt0t1=match(t0,t1)with|Null,Null->true|Thisv0,Thisv1->eqv0v1|_->falseletcomparecmpt0t1=match(t0,t1)with|Null,Null->0|Null,This_->-1|This_,Null->1|Thisv0,Thisv1->cmpv0v1letto_result~null=functionNull->Errornull|Thisv->Okvletto_list=functionNull->[]|Thisv->[v]letto_seq=functionNull->Seq.empty|Thisv->Seq.returnvletto_option=functionNull->None|Thisv->Somevletof_option=functionNone->Null|Somev->Thisv