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-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65

doc/src/octez-libs.error-monad-legacy/error_monad.ml.html

Source file error_monad.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(*****************************************************************************)
(*                                                                           *)
(* SPDX-License-Identifier: MIT                                              *)
(* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com>                *)
(* Copyright (c) 2023 Trilitech <contact@trili.tech>                         *)
(*                                                                           *)
(*****************************************************************************)

let return = Lwt_result.return

let return_unit = Lwt_result.return ()

let return_none = Lwt_result.return None

let return_some x = Lwt_result.return (Some x)

let return_nil = Lwt_result.return []

let return_true = Lwt_result.return true

let return_false = Lwt_result.return false

let ( >>= ) = Lwt.Infix.( >>= )

let ( >|= ) = Lwt.Infix.( >|= )

let ok = Result.ok

let error e = Error (Tezos_error_monad.TzTrace.make e)

let ( >>? ) = Result.bind

let ( >|? ) x f = Result.map f x

let fail e = Lwt.return (Error (Tezos_error_monad.TzTrace.make e))

let ( >>=? ) = Lwt_result.bind

let ( >|=? ) x f = Lwt_result.map f x

let ( >>?= ) x f = match x with Error _ as e -> Lwt.return e | Ok x -> f x

let ( >|?= ) x f =
  match x with Error _ as e -> Lwt.return e | Ok x -> Lwt.map Result.ok (f x)
OCaml

Innovation. Community. Security.