Module Lwt_result
Explicit error handling
- since
 - 2.6.0
 
type (+'a, +'b) t= ('a, 'b) Result.result Lwt.t
val return : 'a -> ('a, _) tval fail : 'b -> (_, 'b) tval lift : ('a, 'b) Result.result -> ('a, 'b) tval ok : 'a Lwt.t -> ('a, _) tval catch : 'a Lwt.t -> ('a, exn) tcatch xbehaves likereturn yifxevaluates toy, and likefail eifxraisese
val get_exn : ('a, exn) t -> 'a Lwt.tget_exnis the opposite ofcatch: it unwraps the result type, returning the value in case of success, callsLwt.failin case of error.
val map : ('a -> 'b) -> ('a, 'e) t -> ('b, 'e) tval map_err : ('e1 -> 'e2) -> ('a, 'e1) t -> ('a, 'e2) tval bind : ('a, 'e) t -> ('a -> ('b, 'e) t) -> ('b, 'e) tval bind_lwt : ('a, 'e) t -> ('a -> 'b Lwt.t) -> ('b, 'e) tval bind_lwt_err : ('a, 'e1) t -> ('e1 -> 'e2 Lwt.t) -> ('a, 'e2) tval bind_result : ('a, 'e) t -> ('a -> ('b, 'e) Result.result) -> ('b, 'e) tval both : ('a, 'e) t -> ('b, 'e) t -> ('a * 'b, 'e) tLwt.both p_1 p_2returns a promise that is pending until both promisesp_1andp_2become resolved. If onlyp_1isError e, the promise is resolved withError e, If onlyp_2isError e, the promise is resolved withError e, If bothp_1andp_2resolve withError _, the promise is resolved with the error that occurred first.
module Infix : sig ... endmodule Syntax : sig ... end