package octez-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type ('a, 'e) t = unit -> (('a, 'e) node, 'e) Stdlib.result
and (+'a, 'e) node =
  1. | Nil
  2. | Cons of 'a * ('a, 'e) t
include Seqes.Sigs.SEQMON2ALL with type ('a, 'e) mon := ('a, 'e) Stdlib.result with type ('a, 'e) t := ('a, 'e) t
val iter : ('a -> unit) -> ('a, 'e) t -> (unit, 'e) Stdlib.result
val fold_left : ('a -> 'b -> 'a) -> 'a -> ('b, 'e) t -> ('a, 'e) Stdlib.result
val iteri : (int -> 'a -> unit) -> ('a, 'e) t -> (unit, 'e) Stdlib.result
val fold_lefti : ('b -> int -> 'a -> 'b) -> 'b -> ('a, 'e) t -> ('b, 'e) Stdlib.result
val for_all : ('a -> bool) -> ('a, 'e) t -> (bool, 'e) Stdlib.result
val exists : ('a -> bool) -> ('a, 'e) t -> (bool, 'e) Stdlib.result
val find : ('a -> bool) -> ('a, 'e) t -> ('a option, 'e) Stdlib.result
val find_map : ('a -> 'b option) -> ('a, 'e) t -> ('b option, 'e) Stdlib.result
val iter2 : ('a -> 'b -> unit) -> ('a, 'e) t -> ('b, 'e) t -> (unit, 'e) Stdlib.result
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> ('b, 'e) t -> ('c, 'e) t -> ('a, 'e) Stdlib.result
val for_all2 : ('a -> 'b -> bool) -> ('a, 'e) t -> ('b, 'e) t -> (bool, 'e) Stdlib.result
val exists2 : ('a -> 'b -> bool) -> ('a, 'e) t -> ('b, 'e) t -> (bool, 'e) Stdlib.result
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 map : ('a -> 'b) -> ('a, 'e) t -> ('b, 'e) t
val mapi : (int -> 'a -> 'b) -> ('a, 'e) t -> ('b, 'e) t
val filter : ('a -> bool) -> ('a, 'e) t -> ('a, 'e) t
val filter_map : ('a -> 'b option) -> ('a, 'e) t -> ('b, 'e) t
val scan : ('b -> 'a -> 'b) -> 'b -> ('a, 'e) t -> ('b, 'e) t
val take_while : ('a -> bool) -> ('a, 'e) t -> ('a, 'e) t
val drop_while : ('a -> bool) -> ('a, 'e) t -> ('a, 'e) t
val group : ('a -> 'a -> bool) -> ('a, 'e) t -> (('a, 'e) t, 'e) t
val map2 : ('a -> 'b -> 'c) -> ('a, 'e) t -> ('b, 'e) t -> ('c, 'e) t
val map_product : ('a -> 'b -> 'c) -> ('a, 'e) t -> ('b, 'e) t -> ('c, 'e) t
val partition_map : ('a -> ('b, 'c) Stdlib.Either.t) -> ('a, 'e) t -> ('b, 'e) t * ('c, 'e) t
val partition : ('a -> bool) -> ('a, 'e) t -> ('a, 'e) t * ('a, 'e) t
val is_empty : ('a, 'e) t -> (bool, 'e) Stdlib.result
val uncons : ('a, 'e) t -> (('a * ('a, 'e) t) option, 'e) Stdlib.result
val length : ('a, 'e) t -> (int, 'e) Stdlib.result
val equal : ('a -> 'b -> bool) -> ('a, 'e) t -> ('b, 'e) t -> (bool, 'e) Stdlib.result
val compare : ('a -> 'b -> int) -> ('a, 'e) t -> ('b, 'e) t -> (int, 'e) Stdlib.result
val empty : ('a, 'e) t
val return : 'a -> ('a, 'e) t
val cons : 'a -> ('a, 'e) t -> ('a, 'e) t
val repeat : 'a -> ('a, 'e) t
val cycle : ('a, 'e) t -> ('a, 'e) t
val memoize : ('a, 'e) t -> ('a, 'e) t
val once : ('a, 'e) t -> ('a, 'e) t
val transpose : (('a, 'e) t, 'e) t -> (('a, 'e) t, 'e) t
val append : ('a, 'e) t -> ('a, 'e) t -> ('a, 'e) t
val concat : (('a, 'e) t, 'e) t -> ('a, 'e) t
val flat_map : ('a -> ('b, 'e) t) -> ('a, 'e) t -> ('b, 'e) t
val concat_map : ('a -> ('b, 'e) t) -> ('a, 'e) t -> ('b, 'e) t
val zip : ('a, 'e) t -> ('b, 'e) t -> ('a * 'b, 'e) t
val interleave : ('a, 'e) t -> ('a, 'e) t -> ('a, 'e) t
val sorted_merge : ('a -> 'a -> int) -> ('a, 'e) t -> ('a, 'e) t -> ('a, 'e) t
val product : ('a, 'e) t -> ('b, 'e) t -> ('a * 'b, 'e) t
val unzip : ('a * 'b, 'e) t -> ('a, 'e) t * ('b, 'e) t
val split : ('a * 'b, 'e) t -> ('a, 'e) t * ('b, 'e) t
val of_dispenser : (unit -> ('a option, 'e) Stdlib.result) -> ('a, 'e) t
val to_dispenser : ('a, 'e) t -> unit -> ('a option, 'e) Stdlib.result
val ints : int -> (int, 'e) t
val of_seq : 'a Stdlib.Seq.t -> ('a, 'e) t
val return_e : ('a, 'e) Stdlib.result -> ('a, '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.

val map_error : ('e -> 'f) -> ('a, 'e) t -> ('a, 'f) t

map_error f seq is a sequence feq.

  • If seq is a whole sequence, then feq is the same whole sequence.
  • If seq is an interrupted sequence, then feq is a sequence interrupted by Error (f e) where the elements of the successful prefix are the elements of the successful prefix of seq.
val iter_p : ('a -> unit Lwt.t) -> ('a, 'e) t -> (unit, 'e) Stdlib.result Lwt.t

iter_p f seq is a promise p.

  • If seq is a whole sequence, then p resolves to Ok () once all the promises created by f on the elements of seq have resolved.
  • If seq is interrupted by Error e, then p resolves to Error e once all the promises created by f on the elements of the successful prefix of seq have resolved.

Note that the behaviour for interrupted sequences is in line with the best-effort semantic of Lwtreslib.

val cons_e : ('a, 'e) Stdlib.result -> ('a, 'e) t -> ('a, 'e) t

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.

val take : when_negative_length:'err -> int -> ('a, 'e) t -> (('a, 'e) t, 'err) Stdlib.result
val drop : when_negative_length:'err -> int -> ('a, 'e) t -> (('a, 'e) t, 'err) Stdlib.result
module E : Seqes.Sigs.SEQMON2TRANSFORMERS with type ('a, 'e) t := ('a, 'e) t and type ('a, 'e) mon := ('a, 'e) Stdlib.result and type ('a, 'e) callermon := ('a, 'e) Stdlib.result
module S : Seqes.Sigs.SEQMON2TRAVERSORS with type ('a, 'e) t := ('a, 'e) t and type ('a, 'e) mon := ('a, 'e) Stdlib.result Lwt.t and type ('a, 'e) callermon := 'a Lwt.t
module ES : Seqes.Sigs.SEQMON2TRAVERSORS with type ('a, 'e) t := ('a, 'e) t and type ('a, 'e) mon := ('a, 'e) Stdlib.result Lwt.t and type ('a, 'e) callermon := ('a, 'e) Stdlib.result Lwt.t
val of_seq_catch : 'a Stdlib.Seq.t -> ('a, exn) t

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.

val of_seq_once : when_forced_twice:'e -> 'a Stdlib.Seq.t -> ('a, 'e) t

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))
val of_seq_e : ('a, 'e) Stdlib.result Stdlib.Seq.t -> ('a, 'e) t
OCaml

Innovation. Community. Security.