Below is the API for the OCaml standard library. It's directly copied over from the OCaml Manual, formatted to the Reason syntax and styled accordingly. The API docs are work-in-progress; we'll be polishing these gradually!
module Stream: sig .. end
type t 'a;
exception Error string;
let from: (int => option 'a) => t 'a;
Stream.from freturns a stream built from the function
f. To create a new stream element, the function
fis called with the current stream count. The user function
fmust return either
Some <value>for a value or
Noneto 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
let of_list: list 'a => t 'a;
let of_string: string => t char;
let of_bytes: bytes => t char;
let of_channel: Pervasives.in_channel => t char;
let iter: ('a => unit) => t 'a => unit;
Stream.iter f sscans the whole stream s, applying function
fin turn to each stream element encountered.
let next: t 'a => 'a;
let empty: t 'a => unit;
()if the stream is empty, else raise
let peek: t 'a => option 'a;
Someof "the first element" of the stream, or
Noneif the stream is empty.
let junk: t 'a => unit;
let count: t 'a => int;
let npeek: int => t 'a => list 'a;
npeek nreturns the list of the
nfirst elements of the stream, or all its remaining elements if less than
nelements are available.