package tezos-lwt-result-stdlib

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

S is the signature for a Lwt, result and Lwt-result combined monad. It is similar to Bare_sigs.Monad with the addition of traces. Specifically:

  • The type 'error trace is meant to be substituted by a type provided by a Trace module (with type 'error trace := 'error Trace.trace).
  • The functions Traced_result_syntax.fail and Traced_lwt_result_syntax.fail wrap the provided error in a trace,
  • {join,all,both} return 'error trace rather than 'error list,
  • The binding operators Traced_result_syntax.(and*) and Traced_lwt_result_syntax.(and*) are available.

Import the non-traced modules as-is

include Bare_sigs.Monad.S

The tower of monads

The Lwt monad: for concurrency

module Lwt_syntax : sig ... end

Syntax module for Lwt. This is intended to be opened locally in functions which use Lwt for control-flow. Within the scope of this module, the code can include binding operators, leading to a let-style syntax.

The Option monad: for optional data

module Option_syntax : sig ... end

Syntax module for Option. This is intended to be opened locally in functions which use option for control-flow. Within the scope of this module, the code can include binding operators, leading to a let-style syntax.

The (generic) Result monad: for success/failure

module Result_syntax : sig ... end

Syntax module for Result. This is intended to be opened locally in functions which use result for control-flow. Within the scope of this module, the code can include binding operators, leading to a let-style syntax.

The combined Lwt+Option monad: for concurrent optional values

module Lwt_option_syntax : sig ... end

Syntax module for Lwt+Option. This is intended to be opened locally in functions which use Lwt and option for control-flow. Within the scope of this module, the code can include binding operators, leading to a let-style syntax.

The combined Lwt+Result monad: for concurrent successes/failures

module Lwt_result_syntax : sig ... end

Syntax module for Lwt+Result. This is intended to be opened locally in functions which use Lwt and result for control-flow. Within the scope of this module, the code can include binding operators, leading to a let-style syntax.

type 'error trace

'error trace is intended to be substituted by a type provided by a Trace module (with type 'error trace := 'error Trace.trace)

module Traced_result_syntax : sig ... end
module Lwt_traced_result_syntax : sig ... end