This module provides helpers for values of type ('a, 'b) result Lwt.t. The module is experimental and may change in the future.
catch x behaves like return y if x () evaluates to y, and like fail e if x () raises e
get_exn is the opposite of catch: it unwraps the result type, returning the value in case of success, calls Lwt.fail in case of error.
Sourceval map : ('a -> 'b) -> ('a, 'e) t -> ('b, 'e) t Sourceval map_error : ('e1 -> 'e2) -> ('a, 'e1) t -> ('a, 'e2) t Sourceval bind : ('a, 'e) t -> ('a -> ('b, 'e) t) -> ('b, 'e) t Sourceval bind_error : ('a, 'e1) t -> ('e1 -> ('a, 'e2) t) -> ('a, 'e2) t Sourceval bind_lwt : ('a, 'e) t -> ('a -> 'b Lwt.t) -> ('b, 'e) t Sourceval bind_lwt_error : ('a, 'e1) t -> ('e1 -> 'e2 Lwt.t) -> ('a, 'e2) t Sourceval bind_result : ('a, 'e) t -> ('a -> ('b, 'e) result) -> ('b, 'e) t Sourceval both : ('a, 'e) t -> ('b, 'e) t -> ('a * 'b, 'e) t Lwt.both p_1 p_2 returns a promise that is pending until both promises p_1 and p_2 become resolved. If only p_1 is Error e, the promise is resolved with Error e, If only p_2 is Error e, the promise is resolved with Error e, If both p_1 and p_2 resolve with Error _, the promise is resolved with the error that occurred first.
iter f r is f v if r is a promise resolved with Ok v, and Lwt.return_unit otherwise.
iter_error f r is f v if r is a promise resolved with Error v, and Lwt.return_unit otherwise.
include module type of Infix
Sourceval (>|=) : ('a, 'e) t -> ('a -> 'b) -> ('b, 'e) t Sourceval (>>=) : ('a, 'e) t -> ('a -> ('b, 'e) t) -> ('b, 'e) t Deprecated
Sourceval map_err : ('e1 -> 'e2) -> ('a, 'e1) t -> ('a, 'e2) t Sourceval bind_lwt_err : ('a, 'e1) t -> ('e1 -> 'e2 Lwt.t) -> ('a, 'e2) t