123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151open!Coreopen!Async_kernelopen!ImportmoduletypeEager_deferred_or_error=sigtype+'adeferredtype'at='aOr_error.tdeferredincludeMonad.Swithtype'at:='atvalfail:Error.t->_tvalok_unit:unittvalok_exn:'at->'adeferredvalof_exn:?backtrace:[`Get|`Thisofstring]->exn->_tvalof_exn_result:?backtrace:[`Get|`Thisofstring]->('a,exn)Result.tdeferred->'atvalerror:string->'a->('a->Sexp.t)->_tvalerror_s:Sexp.t->_tvalerror_string:string->_tvalerrorf:('a,unit,string,_t)format4->'avaltag:'at->tag:string->'atvaltag_s:'at->tag:Sexp.t->'atvaltag_s_lazy:'at->tag:Sexp.tLazy.t->'atvaltag_arg:'at->string->'b->('b->Sexp.t)->'atvalunimplemented:string->_tvalfind_map_ok:'alist->f:('a->'bt)->'bt(** Note that [try_with f] is eager only in the [Ok] case. *)valtry_with:?extract_exn:bool->?run:[`Now|`Schedule]->?rest:[`Log|`Raise|`Callofexn->unit](** default is [`Raise] *)->?here:Lexing.position->?name:string->(unit->'adeferred)->'at(** Note that [try_with_join f] is eager only when no exception is raised by [f]. *)valtry_with_join:?extract_exn:bool->?run:[`Now|`Schedule]->?rest:[`Log|`Raise|`Callofexn->unit](** default is [`Raise] *)->?here:Lexing.position->?name:string->(unit->'at)->'atvalcombine_errors:'atlist->'alisttvalcombine_errors_unit:unittlist->unittvalfilter_ok_at_least_one:'atlist->'alisttmoduleList:Monad_sequence.Swithtype'amonad:='atwithtype'at:='alistvalrepeat_until_finished:'state->('state->[`Repeatof'state|`Finishedof'result]t)->'resulttendmoduletypeEager_deferred1=sigtype+'atincludeInvariant.S1withtype'at:='atincludeMonadwithtype'at:='atmoduleInfix:sigincludeMonad.Infixwithtype'at:='atval(>>>):'at->('a->unit)->unitendvalany:'atlist->'atvalany_unit:unittlist->unittvalboth:'at->'bt->('a*'b)tvalcreate:('aIvar.t->unit)->'atvaldon't_wait_for:unitt->unitvalis_determined:'at->boolvalnever:unit->_tvalok:'at->('a,_)Core.Result.ttvalpeek:'at->'aoptionvalunit:unittvalupon:'at->('a->unit)->unitvalvalue_exn:'at->'avalrepeat_until_finished:'state->('state->[`Repeatof'state|`Finishedof'result]t)->'resulttmoduleList:Monad_sequence.Swithtype'amonad:='atwithtype'at:='alistmoduleOr_error:Eager_deferred_or_errorwithtype'adeferred:='atmoduleMemo:Deferred.Memo.Swithtype'adeferred:='atmoduleResult:sigincludeMonad.S2withtype('a,'b)t=('a,'b)Result.tDeferred.tvalfail:'err->(_,'err)t(** e.g., [failf "Couldn't find bloogle %s" (Bloogle.to_string b)]. *)valfailf:('a,unit,string,(_,string)t)format4->'avalmap_error:('ok,'error1)t->f:('error1->'error2)->('ok,'error2)t(** [combine] waits on both inputs and combines their results using [Result.combine]. *)valcombine:('ok1,'err)t->('ok2,'err)t->ok:('ok1->'ok2->'ok3)->err:('err->'err->'err)->('ok3,'err)tendendmoduletypeS=sigtype+'atincludeEager_deferred1withtype'at:='at(** @open *)(** Intended usage is to [open Eager_deferred.Use] to shadow operations from the
non-eager world and rebind them to their eager counterparts. *)moduleUse:sigmoduleDeferred:sigtypenonrec'at='at[@@derivingsexp_of]includeEager_deferred1withtype'at:='atendincludeMonad.Infixwithtype'at:='atincludemoduletypeofDeferred.Let_syntaxvalupon:'at->('a->unit)->unitval(>>>):'at->('a->unit)->unitval(>>=?):('a,'e)Core.Result.tt->('a->('b,'e)Core.Result.tt)->('b,'e)Core.Result.ttval(>>|?):('a,'e)Core.Result.tt->('a->'b)->('b,'e)Core.Result.ttendendmoduletypeEager_deferred=sigmoduletypeS=SincludeSwithtype'at:='aDeferred.tend