package lsp

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type 'a t

Stream inputs.

A In.t value represents the side of a stream where values can be read from. A stream input can only be consumed by one fiber at a time. Trying to access a stream input concurrently will result in an exception.

When passing a stream input through one of the transformation functions such as filter_map or iteration function, the original stream input can no longer be used for another purpose.

val create : (unit -> 'a option t) -> 'a t

Create a stream that is fed from a generator function. Every time a value is requested, this function is called to produce a new value. If the function raises, the stream will no longer be usable.

val of_list : 'a list -> 'a t

Create a stream that yields elements from the given list in order.

val empty : unit -> 'a t

The empty stream.

val read : 'a t -> 'a option t

Consumes and returns the next element from the stream. Once the stream is exhausted, read always returns None.

val filter_map : 'a t -> f:('a -> 'b option) -> 'b t
val sequential_iter : 'a t -> f:('a -> unit t) -> unit t
val parallel_iter : 'a t -> f:('a -> unit t) -> unit t
val append : 'a t -> 'a t -> 'a t
OCaml

Innovation. Community. Security.