package octez-libs

  1. Overview
  2. Docs

The traced Result monad: for successes and traced failures

The Traced_result_syntax module is similar to the Result_syntax module with the following differences:

  • fail wraps the error in a trace,
  • and* and and+ are provided

See Result_syntax.

val return : 'a -> ('a, 'error) result
val return_unit : (unit, 'error) result
val return_none : ('a option, 'error) result
val return_some : 'a -> ('a option, 'error) result
val return_nil : ('a list, 'error) result
val return_true : (bool, 'error) result
val return_false : (bool, 'error) result
val fail : 'error -> ('a, 'error trace) result

fail e is (Error (Trace.make e)) where Trace is the Traced_sigs.Trace module that provides the trace type and functions.

val let* : ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result
val and* : ('a, 'e trace) result -> ('b, 'e trace) result -> ('a * 'b, 'e trace) result
val let+ : ('a, 'e) result -> ('a -> 'b) -> ('b, 'e) result
val and+ : ('a, 'e trace) result -> ('b, 'e trace) result -> ('a * 'b, 'e trace) result
val join : (unit, 'error trace) result list -> (unit, 'error trace) result
val all : ('a, 'error trace) result list -> ('a list, 'error trace) result
val both : ('a, 'error trace) result -> ('b, 'error trace) result -> ('a * 'b, 'error trace) result
OCaml

Innovation. Community. Security.