package tezos-lwt-result-stdlib

  1. Overview
  2. Docs
Tezos: error-aware stdlib replacement

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-v12.3.tar.bz2
sha256=296bb5674bc6050afe6330326fbdd0dfc2255d414bfd6b79cc7666ac6b39316d
sha512=c061cd300a9410300851158d77bf8e56ca3c568b0b1161b38305e5b2efdcd9c746d391f832fdb2826f9a1d6babce10a9b764a4b04f5df42699f7314b9863123a

doc/bare_structs/Bare_structs/Map/Make/index.html

Module Map.MakeSource

Parameters

module Ord : Stdlib.Map.OrderedType

Signature

type key = Ord.t
type !+'a t
Sourcemodule Legacy : Stdlib.Map.S with type key = key and type 'a t = 'a t
val empty : 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val add : key -> 'a -> 'a t -> 'a t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
Sourceval iter_e : (key -> 'a -> (unit, 'trace) Stdlib.result) -> 'a t -> (unit, 'trace) Stdlib.result

iter_e f m applies f to the bindings of m one by one in an unspecified order. If all the applications result in Ok (), then the result of the iteration is Ok (). If any of the applications results in Error e then the iteration stops and the result of the iteration is Error e.

Sourceval iter_s : (key -> 'a -> unit Lwt.t) -> 'a t -> unit Lwt.t
Sourceval iter_p : (key -> 'a -> unit Lwt.t) -> 'a t -> unit Lwt.t
Sourceval iter_es : (key -> 'a -> (unit, 'trace) Stdlib.result Lwt.t) -> 'a t -> (unit, 'trace) Stdlib.result Lwt.t

iter_es f m applies f to the bindings of m in an unspecified order, one after the other as the promises resolve. If all the applications result in Ok (), then the result of the iteration is Ok (). If any of the applications results in Error e then the iteration stops and the result of the iteration is Error e.

Sourceval iter_ep : (key -> 'a -> (unit, 'error) Stdlib.result Lwt.t) -> 'a t -> (unit, 'error list) Stdlib.result Lwt.t

iter_ep f m applies f to the bindings of m. All the applications are done concurrently. If all the applications result in Ok (), then the result of the iteration is Ok (). If any of the applications results in Error e then the result of the iteration is Error e.

val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

fold f m init is

let acc = f k1 d1 init in
let acc = f k2 d2 acc in
let acc = f k3 d3 acc in
…

where kN is the key bound to dN in m.

Sourceval fold_e : (key -> 'a -> 'b -> ('b, 'trace) Stdlib.result) -> 'a t -> 'b -> ('b, 'trace) Stdlib.result

fold_e f m init is

let open Result_syntax in
let* acc = f k1 d1 init in
let* acc = f k2 d2 acc in
let* acc = f k3 d3 acc in
…

where kN is the key bound to dN in m.

Sourceval fold_s : (key -> 'a -> 'b -> 'b Lwt.t) -> 'a t -> 'b -> 'b Lwt.t

fold_s f m init is

let open Lwt_syntax in
let* acc = f k1 d1 init in
let* acc = f k2 d2 acc in
let* acc = f k3 d3 acc in
…

where kN is the key bound to dN in m.

Sourceval fold_es : (key -> 'a -> 'b -> ('b, 'trace) Stdlib.result Lwt.t) -> 'a t -> 'b -> ('b, 'trace) Stdlib.result Lwt.t

fold_es f m init is

let open Lwt_result_syntax in
let* acc = f k1 d1 init in
let* acc = f k2 d2 acc in
let* acc = f k3 d3 acc in
…

where kN is the key bound to dN in m.

val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
Sourceval min_binding : 'a t -> (key * 'a) option
Sourceval max_binding : 'a t -> (key * 'a) option
Sourceval choose : 'a t -> (key * 'a) option
val split : key -> 'a t -> 'a t * 'a option * 'a t
Sourceval find : key -> 'a t -> 'a option
Sourceval find_first : (key -> bool) -> 'a t -> (key * 'a) option
Sourceval find_last : (key -> bool) -> 'a t -> (key * 'a) option
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
OCaml

Innovation. Community. Security.