package tezos-lwt-result-stdlib
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=296bb5674bc6050afe6330326fbdd0dfc2255d414bfd6b79cc7666ac6b39316d
sha512=c061cd300a9410300851158d77bf8e56ca3c568b0b1161b38305e5b2efdcd9c746d391f832fdb2826f9a1d6babce10a9b764a4b04f5df42699f7314b9863123a
doc/traced_structs/Traced_structs/Hashtbl/Make/argument-2-Seq/index.html
Parameter Make.Seq
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 -> bool
val length : 'a t -> int
val iter : ('a -> unit) -> 'a t -> unit
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val fold_lefti : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool
val find : ('a -> bool) -> 'a t -> 'a option
val find_map : ('a -> 'b option) -> 'a t -> 'b option
val empty : 'a t
val return : 'a -> 'a t
val init : int -> (int -> 'a) -> 'a t
val repeat : 'a -> 'a t
val forever : (unit -> 'a) -> 'a t
val iterate : ('a -> 'a) -> 'a -> 'a t
val of_dispenser : (unit -> 'a option) -> 'a t
val to_dispenser : 'a t -> unit -> 'a option
val ints : int -> int t
Some values that made it to Stdlib's Seq since
Lwtreslib-specific extensions
val first : 'a t -> 'a option
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.result
Similar to fold_left
but wraps the traversal in result
. The traversal is interrupted if one of the step returns an Error _
.
val fold_left_s : ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b t -> 'a Lwt.t
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.t
Similar 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 _
.
val iter_e :
('a -> (unit, 'trace) Stdlib.result) ->
'a t ->
(unit, 'trace) Stdlib.result
Similar to iter
but wraps the iteration in result
. The iteration is interrupted if one of the step returns an Error _
.
val iter_s : ('a -> unit Lwt.t) -> 'a t -> unit Lwt.t
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.t
Similar 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_p : ('a -> unit Lwt.t) -> 'a t -> unit Lwt.t
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.
val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t
val iter_ep :
('a -> (unit, 'error Monad.trace) Stdlib.result Lwt.t) ->
'a t ->
(unit, 'error Monad.trace) Stdlib.result Lwt.t
Similar 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.