package tezos-base

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

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 TzTrace.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 TzTrace.trace) result -> ('b, 'e TzTrace.trace) result -> ('a * 'b, 'e TzTrace.trace) result
val let+ : ('a, 'e) result -> ('a -> 'b) -> ('b, 'e) result
val and+ : ('a, 'e TzTrace.trace) result -> ('b, 'e TzTrace.trace) result -> ('a * 'b, 'e TzTrace.trace) result
val join : (unit, 'error TzTrace.trace) result list -> (unit, 'error TzTrace.trace) result
val all : ('a, 'error TzTrace.trace) result list -> ('a list, 'error TzTrace.trace) result
val both : ('a, 'error TzTrace.trace) result -> ('b, 'error TzTrace.trace) result -> ('a * 'b, 'error TzTrace.trace) result
OCaml

Innovation. Community. Security.