Module Deferred.Or_error
include Async_kernel.Deferred.Or_error
module Deferred = Async_kernel__.Deferred1type 'a t= 'a Core_kernel.Or_error.t Deferred.t
The applicative operations match the behavior of the applicative operations in Or_error. This means that all and all_unit are equivalent to combine_errors and combine_errors_unit respectively.
include Core_kernel.Applicative.S with type 'a t := 'a t
val apply : ('a -> 'b) t -> 'a t -> 'b tval map2 : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c tval map3 : 'a t -> 'b t -> 'c t -> f:('a -> 'b -> 'c -> 'd) -> 'd tval all : 'a t list -> 'a list tval all_unit : unit t list -> unit t
module Applicative_infix : Base__.Applicative_intf.Applicative_infix with type 'a t := 'a treturn x = Deferred.return (Ok x) *
include Core_kernel.Monad.S with type 'a t := 'a t
include Base__.Monad_intf.S_without_syntax with type 'a t := 'a t
module Monad_infix : Base__.Monad_intf.Infix with type 'a t := 'a tval return : 'a -> 'a treturn vreturns the (trivial) computation that returns v.
val fail : Core_kernel.Error.t -> _ tfail error = Deferred.return (Error error)*
val ok_exn : 'a t -> 'a Deferred.tThese functions are direct analogs of the corresponding
Core.Or_errorfunctions.
val of_exn : exn -> _ tval of_exn_result : ('a, exn) Core_kernel.Result.t Deferred.t -> 'a tval error : string -> 'a -> ('a -> Core_kernel.Sexp.t) -> _ tval error_s : Core_kernel.Sexp.t -> _ tval error_string : string -> _ tval errorf : ('a, unit, string, _ t) Core_kernel.format4 -> 'aval tag : 'a t -> tag:string -> 'a tval tag_s : 'a t -> tag:Core_kernel.Sexp.t -> 'a tval tag_arg : 'a t -> string -> 'b -> ('b -> Core_kernel.Sexp.t) -> 'a tval unimplemented : string -> _ tval combine_errors : 'a t list -> 'a list tval combine_errors_unit : unit t list -> unit tval filter_ok_at_least_one : 'a t list -> 'a list tval find_map_ok : 'a list -> f:('a -> 'b t) -> 'b tfind_map_ok l ~freturns the first value inlfor whichfreturnsOk, otherwise it returns the same error ascombine_errors (Deferred.List.map l ~f).
val ok_unit : unit tok_unit = return ()
val try_with : ?extract_exn:bool -> ?run:[ `Now | `Schedule ] -> ?here:Stdlib.Lexing.position -> ?name:string -> (unit -> 'a Deferred.t) -> 'a ttry_with fcatches exceptions thrown byfand returns them in the Result.t as an Error.t.try_with_joinis liketry_with, except thatfcan throw exceptions or return anErrordirectly, without ending up with a nested error; it is equivalent totry_with f >>| Result.join.The option
extract_exnis passed along toMonitor.try_with ?extract_exnand specifies whether or not the monitor exn wrapper should be skipped (extract_exn:trueor kept (extract_exn:false).
val try_with_join : ?extract_exn:bool -> ?run:[ `Now | `Schedule ] -> ?here:Stdlib.Lexing.position -> ?name:string -> (unit -> 'a t) -> 'a t
module List = Async_kernel__.Deferred_or_error.ListAll of the
Listfunctions that take ahowargument treat it the following way:
val repeat_until_finished : 'state -> ('state -> [ `Repeat of 'state | `Finished of 'result ] t) -> 'result trepeat_until_finished initial_state fworks the just likeDeferred.repeat_until_finishedbut with theDeferred.Or_errormonad. Iffreturns anOr_error.Errorthe loop terminates and returns.
module Expect_test_config = Async__.Deferred_or_error_expect_test_config