package octez-proto-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V5/Make/Seq/index.html
Module Make.SeqSource
val empty : 'a tval return : 'a -> 'a tval fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'aval iter : ('a -> unit) -> 'a t -> unitval unfold : ('b -> ('a * 'b) option) -> 'b -> 'a tLwtreslib-specific extensions
val first : 'a t -> 'a optionfirst 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) Pervasives.result) ->
'a ->
'b t ->
('a, 'trace) Pervasives.resultval fold_left_es :
('a -> 'b -> ('a, 'trace) Pervasives.result Lwt.t) ->
'a ->
'b t ->
('a, 'trace) Pervasives.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 _.
val iter_e :
('a -> (unit, 'trace) Pervasives.result) ->
'a t ->
(unit, 'trace) Pervasives.resultval iter_es :
('a -> (unit, 'trace) Pervasives.result Lwt.t) ->
'a t ->
(unit, 'trace) Pervasives.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, 'error Error_monad.trace) Pervasives.result Lwt.t) ->
'a t ->
(unit, 'error Error_monad.trace) Pervasives.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.