package octez-libs

  1. Overview
  2. Docs
A package that contains multiple base libraries used by the Octez suite

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-18.0.tar.gz
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a

doc/octez-libs.lwt-result-stdlib/Tezos_lwt_result_stdlib/Lwtreslib/Traced/Monad/Option_syntax/index.html

Module Monad.Option_syntax

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.

See also Option

val return : 'a -> 'a option

return x is Some x.

val fail : 'a option

fail is None. It is also an alias for Option.none.

val return_unit : unit option

return_unit is Some ().

val return_nil : 'a list option

return_nil is Some [].

val return_true : bool option

return_true is Some true.

val return_false : bool option

return_false is Some false.

Note that we do not provide return_some nor return_none. Both of these functions are possible but somewhat confusing and rarely useful in practice. If you need to carry options within a Option-monad computation (yielding to values of the type 'a option option), you need to do so by hand: return (Some …) and return None.

val (let*) : 'a option -> ('a -> 'b option) -> 'b option

let* is a binding operator alias for Option.bind.

val (and*) : 'a option -> 'b option -> ('a * 'b) option

and* is a binding operator alias for both.

val (let+) : 'a option -> ('a -> 'b) -> 'b option

let+ is a binding operator alias for Option.map.

val (and+) : 'a option -> 'b option -> ('a * 'b) option

and+ is a binding operator alias for both.

val both : 'a option -> 'b option -> ('a * 'b) option

both is the joining of two optional non-unit values. both a b is Some (x, y) iff a is Some x and b is Some y.

OCaml

Innovation. Community. Security.