Module Mavryk_alpha_test_helpers.Lwt_result_wrap_syntax

Extends the Lwt_result_syntax with additional utilities for wrapping results produced by the protocol, i.e. Environment.Error_monad.tzresult, to tzresult Lwt.t values used in the tests.

The added utilities are binding operators. They use the same symbols as the ones from Lwt_result_syntax with an added @ character. This character symbolizes the ewrapping of the internal error monad type in a shell error.

include module type of Mavryk_base.TzPervasives.Lwt_result_syntax
include module type of Mavryk_error_monad.TzLwtreslib.Monad.Lwt_result_syntax
val return : 'a -> ('a, 'e) Stdlib.result Lwt.t
val return_unit : (unit, 'e) Stdlib.result Lwt.t
val return_none : ('a option, 'e) Stdlib.result Lwt.t
val return_some : 'a -> ('a option, 'e) Stdlib.result Lwt.t
val return_nil : ('a list, 'e) Stdlib.result Lwt.t
val return_true : (bool, 'e) Stdlib.result Lwt.t
val return_false : (bool, 'e) Stdlib.result Lwt.t
val fail : 'e -> ('a, 'e) Stdlib.result Lwt.t
val let* : ('a, 'e) Stdlib.result Lwt.t -> ('a -> ('b, 'e) Stdlib.result Lwt.t) -> ('b, 'e) Stdlib.result Lwt.t
val let+ : ('a, 'e) Stdlib.result Lwt.t -> ('a -> 'b) -> ('b, 'e) Stdlib.result Lwt.t
val lwt_map_error : ('e -> 'f) -> ('a, 'e) Stdlib.result Lwt.t -> ('a, 'f) Stdlib.result Lwt.t
val let*! : 'a Lwt.t -> ('a -> 'b Lwt.t) -> 'b Lwt.t
val let*? : ('a, 'e) Stdlib.result -> ('a -> ('b, 'e) Stdlib.result Lwt.t) -> ('b, 'e) Stdlib.result Lwt.t
val join : (unit, 'e) Stdlib.result Lwt.t list -> (unit, 'e list) Stdlib.result Lwt.t
val all : ('a, 'e) Stdlib.result Lwt.t list -> ('a list, 'e list) Stdlib.result Lwt.t
val both : ('a, 'e) Stdlib.result Lwt.t -> ('b, 'e) Stdlib.result Lwt.t -> ('a * 'b, 'e list) Stdlib.result Lwt.t
val tzfail : 'error -> ('a, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t
val and* : ('a, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t -> ('b, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t -> ('a * 'b, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t
val and+ : ('a, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t -> ('b, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t -> ('a * 'b, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t
val tzjoin : (unit, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t list -> (unit, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t
val tzall : ('a, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t list -> ('a list, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t
val tzboth : ('a, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t -> ('b, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t -> ('a * 'b, 'error Mavryk_base.TzPervasives.TzTrace.trace) Stdlib.result Lwt.t

wrap res maps the result type contained in res to a tzresult value.

let@ x = m in f x is equivalent to let x = Environment.wrap_tzresult m in f x

let*@ x = m in f x is equivalent to let* x = wrap m in f x.

Mnemonic: @ "wraps" a protocol error in a shell error.

let*?@ x = m in f x is equivalent to let*? x = Environment.wrap_tzresult m in f x.

Mnemonic: @ "wraps" a protocol error in a shell error.

let*!@ x = m in f x is equivalent to let*! x = wrap m in f x.

Mnemonic: @ "wraps" a protocol error in a shell error.

let+@ x = m in f x is equivalent to let+ x = wrap m in f x.

Mnemonic: @ "wraps" a protocol error in a shell error.