package octez-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
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.tinclude 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) tval unfold : ('b -> ('a * 'b) option) -> 'b -> ('a, 'e) tval forever : (unit -> 'a) -> ('a, 'e) tval iterate : ('a -> 'a) -> 'a -> ('a, 'e) tval of_dispenser : (unit -> 'a option) -> ('a, 'e) tval empty : ('a, 'e) tval return : 'a -> ('a, 'e) tval repeat : 'a -> ('a, 'e) tval ints : int -> (int, 'e) treturn_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) tinterrupted e is a sequence immediately interrupted by the error e.
map_error f seq is a sequence feq.
- If
seqis a whole sequence, thenfeqis the same whole sequence. - If
seqis an interrupted sequence, thenfeqis 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
seqis a whole sequence, thenpresolves toOk ()once all the promises created byfon the elements ofseqhave resolved. - If
seqis interrupted byError e, thenpresolves toError eonce all the promises created byfon the elements of the successful prefix ofseqhave 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))