package tezos-lwt-result-stdlib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=296bb5674bc6050afe6330326fbdd0dfc2255d414bfd6b79cc7666ac6b39316d
sha512=c061cd300a9410300851158d77bf8e56ca3c568b0b1161b38305e5b2efdcd9c746d391f832fdb2826f9a1d6babce10a9b764a4b04f5df42699f7314b9863123a
doc/bare_structs/Bare_structs/Seq/index.html
Module Bare_structs.SeqSource
include Bare_sigs.Seq.S
Common interface with Stdlib
include module type of Stdlib.Seq
with type 'a t = 'a Stdlib.Seq.t
and type 'a node = 'a Stdlib.Seq.node
val is_empty : 'a t -> boolval length : 'a t -> intval iter : ('a -> unit) -> 'a t -> unitval fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'aval iteri : (int -> 'a -> unit) -> 'a t -> unitval fold_lefti : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'bval for_all : ('a -> bool) -> 'a t -> boolval exists : ('a -> bool) -> 'a t -> boolval find : ('a -> bool) -> 'a t -> 'a optionval find_map : ('a -> 'b option) -> 'a t -> 'b optionval empty : 'a tval return : 'a -> 'a tval init : int -> (int -> 'a) -> 'a tval repeat : 'a -> 'a tval forever : (unit -> 'a) -> 'a tval iterate : ('a -> 'a) -> 'a -> 'a tval of_dispenser : (unit -> 'a option) -> 'a tval to_dispenser : 'a t -> unit -> 'a optionval ints : int -> int tSome values that made it to Stdlib's Seq since
Lwtreslib-specific extensions
first s is None if s is empty, it is Some x where x is the first element of s otherwise.
Note that first forces the first element of the sequence, which can have side-effects or be computationally expensive. Consider, e.g., the case where s = filter (fun …) s': first s can force multiple of the values from s'.
val fold_left_e :
('a -> 'b -> ('a, 'trace) Stdlib.result) ->
'a ->
'b t ->
('a, 'trace) Stdlib.resultSimilar to fold_left but wraps the traversal in result. The traversal is interrupted if one of the step returns an Error _.
Similar to fold_left but wraps the traversing in Lwt. Each step of the traversal is started after the previous one has resolved. The traversal is interrupted if one of the promise is rejected.
val fold_left_es :
('a -> 'b -> ('a, 'trace) Stdlib.result Lwt.t) ->
'a ->
'b t ->
('a, 'trace) Stdlib.result Lwt.tSimilar to fold_left but wraps the traversing in result Lwt.t. Each step of the traversal is started after the previous one resolved. The traversal is interrupted if one of the step is rejected or is fulfilled with Error _.
Similar to iter but wraps the iteration in result. The iteration is interrupted if one of the step returns an Error _.
Similar to iter but wraps the iteration in Lwt. Each step of the iteration is started after the previous one resolved. The iteration is interrupted if one of the promise is rejected.
val iter_es :
('a -> (unit, 'trace) Stdlib.result Lwt.t) ->
'a t ->
(unit, 'trace) Stdlib.result Lwt.tSimilar to iter but wraps the iteration in result Lwt.t. Each step of the iteration is started after the previous one resolved. The iteration is interrupted if one of the promise is rejected of fulfilled with an Error _.
val iter_ep :
('a -> (unit, 'trace) Stdlib.result Lwt.t) ->
'a t ->
(unit, 'trace list) Stdlib.result Lwt.tSimilar to iter but wraps the iteration in result Lwt.t. All the steps of the iteration are started concurrently. The promise iter_ep resolves once all the promises of the traversal resolve. At this point it either:
- is rejected if at least one of the promises is, otherwise
- is fulfilled with
Error _if at least one of the promises is, otherwise - is fulfilled with
Ok ()if all the promises are.
Similar to iter but wraps the iteration in Lwt. All the steps of the iteration are started concurrently. The promise iter_p f s is resolved only once all the promises of the iteration are. At this point it is either fulfilled if all promises are, or rejected if at least one of them is.