module GenLabels:sig
..end
Label version of Gen
Since 0.2.4
type'a
t =unit -> 'a option
None
when no elements remaintype'a
gen ='a t
module type S = GenLabels_intf.S
val get : 'a t -> 'a option
val next : 'a t -> 'a option
GenLabels.get
val get_exn : 'a t -> 'a
Invalid_argument
if no element remainsval junk : 'a t -> unit
val repeatedly : (unit -> 'a) -> 'a t
include GenLabels.S
module Restart:sig
..end
val persistent : 'a t -> 'a Restart.t
GenLabels.Restart
directly instead.val persistent_lazy : ?caching:bool ->
?max_chunk_size:int -> 'a t -> 'a Restart.t
GenLabels.persistent
, but consumes the generator on demand (by chunks).
This allows to make a restartable generator out of an ephemeral one,
without paying a big cost upfront (nor even consuming it fully).
Optional parameters: see GenMList.of_gen_lazy
.val peek : 'a t -> ('a * 'a option) t
peek g
transforms the generator g
into a generator
of x, Some next
if x
was followed by next
in g
, or x, None
if x
was the last element of g
val peek_n : n:int -> 'a t -> ('a * 'a array) t
peek_n ~n g
iterates on g
, returning along with each element
the array of the (at most) n
elements that follow it immediatelyInvalid_argument
if the int is < 1
val start : 'a Restart.t -> 'a t
start gen
is the same as gen ()
but is included for readability.
Very basic interface to manipulate files as sequence of chunks/lines.
module IO:sig
..end