package cfstream

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of struct include Stream end
type 'a t = 'a Stream.t

The type of streams holding values of type 'a.

exception Failure

Raised by parsers when none of the first components of the stream patterns is accepted.

exception Error of string

Raised by parsers when the first component of a stream pattern is accepted, but one of the following components is rejected.

Stream builders
val from : (int -> 'a option) -> 'a t

Stream.from f returns a stream built from the function f. To create a new stream element, the function f is called with the current stream count. The user function f must return either Some <value> for a value or None to specify the end of the stream.

Do note that the indices passed to f may not start at 0 in the general case. For example, [< '0; '1; Stream.from f >] would call f the first time with count 2.

val of_string : string -> char t

Return the stream of the characters of the string parameter.

val of_bytes : bytes -> char t

Return the stream of the characters of the bytes parameter.

  • since 4.02.0
val of_channel : Pervasives.in_channel -> char t

Return the stream of the characters read from the input channel.

Stream iterator
Predefined parsers
Useful functions
val peek : 'a t -> 'a option

Return Some of "the first element" of the stream, or None if the stream is empty.

val junk : 'a t -> unit

Remove the first element of the stream, possibly unfreezing it before.

val count : 'a t -> int

Return the current count of the stream elements, i.e. the number of the stream elements discarded.

val next_exn : 'a t -> 'a
val next : 'a t -> 'a option
val npeek : 'a t -> int -> 'a list
val is_empty : 'a t -> bool
val empty : unit -> 'a t
val to_stream : 'a -> 'a
val of_stream : 'a -> 'a
exception Expected_streams_of_equal_length
val of_list : 'a list -> 'a t
val iteri : 'a t -> f:(int -> 'a -> 'b) -> unit
val iter : 'a t -> f:('a -> 'b) -> unit
val iter2i_exn : 'a t -> 'b t -> f:(int -> int -> 'a -> 'b -> 'c) -> unit
val iter2_exn : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> unit
val iter2i : 'a t -> 'b t -> f:(int -> int -> 'a -> 'b -> 'c) -> unit
val iter2 : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> unit
val find_map : 'a t -> f:('a -> 'b option) -> 'b option
val find : 'a t -> f:('a -> bool) -> 'a option
val find_exn : 'a t -> f:('a -> bool) -> 'a
val exists : 'a t -> f:('a -> bool) -> bool
val for_all : 'a t -> f:('a -> bool) -> bool
val foldi : 'a t -> init:'b -> f:(int -> 'b -> 'a -> 'b) -> 'b
val fold : 'a t -> init:'b -> f:('b -> 'a -> 'b) -> 'b
val reduce : 'a t -> f:('a -> 'a -> 'a) -> 'a
val sum : int t -> int
val fsum : float t -> float
val fold2i_exn : 'a t -> 'b t -> init:'c -> f:(int -> int -> 'c -> 'a -> 'b -> 'c) -> 'c
val fold2_exn : 'a t -> 'b t -> init:'c -> f:('c -> 'a -> 'b -> 'c) -> 'c
val fold2i : 'a t -> 'b t -> init:'c -> f:(int -> int -> 'c -> 'a -> 'b -> 'c) -> 'c
val fold2 : 'a t -> 'b t -> init:'c -> f:('c -> 'a -> 'b -> 'c) -> 'c
val scanl : 'a t -> init:'b -> f:('b -> 'a -> 'b) -> 'b t
val scan : 'a t -> f:('a -> 'a -> 'a) -> 'a t
val take_whilei : 'a t -> f:(int -> 'a -> bool) -> 'a t
val take_while : 'a t -> f:('a -> bool) -> 'a t
val take : 'a t -> n:int -> 'a t
val drop_whilei : 'a t -> f:(int -> 'a -> bool) -> unit
val drop_while : 'a t -> f:('a -> bool) -> unit
val drop : 'a t -> n:int -> unit
val skip_whilei : 'a t -> f:(int -> 'a -> bool) -> 'a t
val skip_while : 'a t -> f:('a -> bool) -> 'a t
val skip : 'a t -> n:int -> 'a t
val span : 'a t -> f:('a -> bool) -> 'a t * 'a t
val group_aux : 'a t -> ('a -> 'b) -> ('b -> 'b -> bool) -> 'a t t
val group : 'a t -> f:('a -> 'b) -> 'a t t
val group_by : 'a t -> eq:('a -> 'a -> bool) -> 'a t t
val mapi : 'a t -> f:(int -> 'a -> 'b) -> 'b t
val map : 'a t -> f:('a -> 'b) -> 'b t
val filter : 'a t -> f:('a -> bool) -> 'a t
val filter_map : 'a t -> f:('a -> 'b option) -> 'b t
val append : 'a t -> 'a t -> 'a t
val concat : 'a t t -> 'a t
val combine : ('a t * 'b t) -> ('a * 'b) t
val uncombine : ('a * 'b) t -> 'a t * 'b t
val merge : 'a t -> 'a t -> cmp:('a -> 'a -> int) -> 'a t
val partition : 'a t -> f:('a -> bool) -> 'a t * 'a t
val uniq : 'a t -> 'a t
val init : int -> f:(int -> 'a) -> 'a t
val singleton : 'a -> 'a t
val to_list : 'a t -> 'a Core.Std.List.t
val result_to_exn : ('a, 'b) Core.Std._result t -> error_to_exn:('b -> exn) -> 'a t
val unfoldi : 'a -> f:(int -> 'a -> ('b * 'a) option) -> 'b t
val unfold : 'a -> f:('a -> ('b * 'a) option) -> 'b t
val range : ?until:int -> int -> int t
val of_lazy : 'a t Core.Std.Lazy.t -> 'a t
val strings_of_channel : ?buffer_size:int -> Core.Std.In_channel.t -> Core.Std.String.t t
val of_array : 'a Core.Std.Array.t -> 'a Stream.t
val to_array : 'a t -> 'a Core.Std.Array.t
val of_hashtbl : ('a, 'b) Core.Std.Hashtbl.t -> ('a Core.Std.Hashtbl.key * 'b) t
val to_hashtbl : ('a Core.Std.Hashtbl.Poly.key * 'b) t -> ('a, 'b) Core.Std.Hashtbl.Poly.t
val of_map : ('a, 'b, 'c) Core.Std.Map.t -> ('a * 'b) t
val to_map : ('a * 'b) t -> ('a, 'b) Core.Std.Map.Poly.t
val of_set : ('a, 'b) Core.Std.Set.t -> 'a t
val to_set : 'a t -> 'a Core.Std.Set.Poly.t
module Infix : sig ... end
OCaml

Innovation. Community. Security.