package octez-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a
doc/octez-libs.lwt-result-stdlib/Tezos_lwt_result_stdlib/Lwtreslib/Traced/Seq_e/index.html
Module Traced.Seq_e
type ('a, 'e) t = ('a, 'e) Bare_structs.Seq_e.t
include Seqes.Sigs.SEQMON2ALL
with type ('a, 'e) mon := ('a, 'e) Stdlib.result
with type ('a, 'e) t := ('a, 'e) t
val init : int -> (int -> 'a) -> ('a, 'e) t
val unfold : ('b -> ('a * 'b) option) -> 'b -> ('a, 'e) t
val forever : (unit -> 'a) -> ('a, 'e) t
val iterate : ('a -> 'a) -> 'a -> ('a, 'e) t
val of_dispenser : (unit -> 'a option) -> ('a, 'e) t
val empty : ('a, 'e) t
val return : 'a -> ('a, 'e) t
val repeat : 'a -> ('a, 'e) t
val ints : int -> (int, 'e) t
return_e (Ok x)
is a whole sequence containing the single element x
. return_e (Error e)
is a sequence immediately interrupted by the error e
.
val interrupted : 'e -> ('a, 'e) t
interrupted e
is a sequence immediately interrupted by the error e
.
map_error f seq
is a sequence feq
.
- If
seq
is a whole sequence, thenfeq
is the same whole sequence. - If
seq
is an interrupted sequence, thenfeq
is a sequence interrupted byError (f e)
where the elements of the successful prefix are the elements of the successful prefix ofseq
.
iter_p f seq
is a promise p
.
- If
seq
is a whole sequence, thenp
resolves toOk ()
once all the promises created byf
on the elements ofseq
have resolved. - If
seq
is interrupted byError e
, thenp
resolves toError e
once all the promises created byf
on the elements of the successful prefix ofseq
have resolved.
Note that the behaviour for interrupted sequences is in line with the best-effort semantic of Lwtreslib.
cons_e (Ok x) s
is the sequence containing x
followed by s
. It is a whole sequence if s
is.
cons_e (Error e) s
is a sequence immediately interrupted by e
.
of_seq_catch s
is a sequence with the same elements as s
which is interrupted when forcing an element of the sequence raises an exception.
of_seq_once ~when_forced_twice s
is a sequence with the same elements as s
which is interrupted when an element of the sequence is forced twice.
In other words, it is equivalent to
map_error
(function Seq.Forced_twice -> when_forced_twice | e -> raise e)
(of_seq_catch (Seq.once s))