12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273(* This file is part of Lwt, released under the MIT license. See LICENSE.md for
details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. *)(** Module [Lwt_result]: explicit error handling *)openResulttype(+'a,+'b)t=('a,'b)Result.resultLwt.tletreturnx=Lwt.return(Okx)letfaile=Lwt.return(Errore)letlift=Lwt.returnletokx=Lwt.map(funy->Oky)xletmapfe=Lwt.map(function|Errore->Errore|Okx->Ok(fx))eletmap_errfe=Lwt.map(function|Errore->Error(fe)|Okx->Okx)eletcatche=Lwt.catch(fun()->oke)failletget_exne=Lwt.binde(function|Okx->Lwt.returnx|Errore->Lwt.faile)letbindef=Lwt.binde(function|Errore->Lwt.return(Errore)|Okx->fx)letbind_lwtef=Lwt.binde(function|Okx->ok(fx)|Errore->faile)letbind_resultef=Lwt.map(function|Errore->Errore|Okx->fx)eletbind_lwt_erref=Lwt.binde(function|Errore->Lwt.bind(fe)fail|Okx->returnx)moduleInfix=structlet(>>=)=bindlet(>|=)ef=mapfeendincludeInfix