package octez-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=55ea1fb8bb3273a7fc270ca8f650d45c56449665619482aad9bc12f3ea736b7e
sha512=fec850fc2d17d7490bbabd5147d62aad13b3aaed8774270f8a38ab419670ed03e0fd30cf8642a97984eca5c2446726fe590ad99c015f7ec50919dc7652f25053
doc/octez-libs.lwt-result-stdlib/Tezos_lwt_result_stdlib/Lwtreslib/Bare/Seq/index.html
Module Bare.SeqSource
Common interface with Stdlib
Note that some functions (namely init, take, and drop) are shadowed with exception-less versions.
Note that once is not shadowed. Be careful when using once: the resulting sequence is ephemeral and using in a non-ephemeral way raises an exception. As a safer alternative, you can use Seq_e.of_seq_once which gives you a result-based (exception-less) ephemeral sequence.
include module type of Seq
with type 'a t = 'a Seq.t
and type 'a node = 'a Seq.node
type !'a t = 'a Seq.tval 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 unfold : ('b -> ('a * 'b) option) -> 'b -> '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 tLwtreslib-specific safety-shadowing
Lwtreslib-specific extensions
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.
val iteri_ep :
(int -> 'a -> (unit, 'trace) result Lwt.t) ->
'a t ->
(unit, 'trace list) result Lwt.tSimilar to iteri but wraps the iteration in result Lwt.t. All the steps of the iteration are started concurrently. The promise iteri_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.
val iter2_ep :
('a -> 'b -> (unit, 'trace) result Lwt.t) ->
'a t ->
'b t ->
(unit, 'trace list) result Lwt.tSimilar to iter2 but wraps the iteration in result Lwt.t. All the steps of the iteration are started concurrently. The promise iter2_ep f s1 s2 resolves once all the promises of the traversal resolve. At this point it is either:
- rejected if at least one of the promises is,
- fulfilled with
Error _if at least one of the promises is, - fulfilled with
Ok ()if all of the promises are.
Note that similarly to Stdlib.Seq.iter2 this function iterates on the common-length prefix of the two sequences. As a result, the iteration can be successful even if the two sequences are of different lengths.
Similar to iter2 but wraps the iteration in Lwt. All the steps of the iteration are started concurrently. The promise iter2_p f s1 s2 resolves once all the promises of the traversal resolve. At this point it is either:
- rejected if at least one of the promises is,
- fulfilled with
()if all of the promises are.
Note that similarly to Stdlib.Seq.iter2 this function iterates on the common-length prefix of the two sequences. As a result, the iteration can be successful even if the two sequences are of different lengths.