Up

Module Any_error

Signature

type ('ok, 'err) t = ('ok, 'err) Async.Std.Deferred.Result.t

A variant of Deferred.Result.t with "any error" semantics. When multiple deferred values that each may be an error are combined, the result may fail with any of the component errors, instead of deterministically choosing a particular one. This enables the result to become determined sooner: for example, Deferred.Or_error.all gives the "leftmost" error if any, so if only the last element of the list is an error, the result will still not be determined until every other element has become so. By contrast, Any_error.all ts may become determined with an error as soon as any element of ts becomes determined with an error.

Note that there is no monad interface, since in a monadic bind, whether or not later deferreds become errors may depend on the value of earlier ones, so "any-error" doesn't make sense in that context. However, the equivalence with Deferred.Result.t is exposed, so you can just use that monad interface where necessary.

include Core.Std.Applicative.S2 with type ('ok, 'err) t := ('ok, 'err) t
type ('a, 'e) t
val return : 'a -> ('a, _) t
val apply : ('a -> 'b, 'e) t -> ('a, 'e) t -> ('b, 'e) t
val map : ('a, 'e) t -> f:('a -> 'b) -> ('b, 'e) t
val map2 : ('a, 'e) t -> ('b, 'e) t -> f:('a -> 'b -> 'c) -> ('c, 'e) t
val map3 : ('a, 'e) t -> ('b, 'e) t -> ('c, 'e) t -> f:('a -> 'b -> 'c -> 'd) -> ('d, 'e) t
val all : ('a, 'e) t list -> ('a list, 'e) t
val both : ('a, 'e) t -> ('b, 'e) t -> ('a * 'b, 'e) t
module Applicative_infix : sig .. end
include module type of Applicative_infix
val (<*>) : ('a -> 'b, 'e) t -> ('a, 'e) t -> ('b, 'e) t
val (<*) : ('a, 'e) t -> (unit, 'e) t -> ('a, 'e) t
val (*>) : (unit, 'e) t -> ('a, 'e) t -> ('a, 'e) t
val all_ignore : (unit, 'err) t list -> (unit, 'err) t