package caqti

  1. Overview
  2. Docs
Unified interface to relational database libraries

Install

dune-project
 Dependency

Authors

Maintainers

Sources

caqti-v3.1.0.tbz
sha256=43cfd7d41627be269449d1f17c4962876d2b383d12fe8c0574e0e07aa3d95243
sha512=b46dcf9e7c012aeefa80f143c840c80d7acd6bb30cd1657486d1adfe345d3570078667caeed728865905c9afd73083ffb1b6983cad7f7ef30e35550506c94c22

doc/caqti.blocking/Caqti_blocking/Stream/index.html

Module Caqti_blocking.StreamSource

Sourcetype ('a, 'err) t = unit -> ('a, 'err) node

A stream, represented as a lazy chain of Cons-nodes terminating in a Nil or an Error.

Sourceand ('a, 'err) node =
  1. | Nil
    (*

    The node of an empty stream

    *)
  2. | Error of 'err
    (*

    A node of a permanently failed stream.

    *)
  3. | Cons of 'a * ('a, 'err) t
    (*

    A node holding the next element and continuation of a stream.

    *)
Sourceval empty : ('a, 'err) t

empty is the empty stream, i.e. it immediately returns Nil.

Sourceval error : 'err -> ('a, 'err) t

error err is a stream which fails immediately with err.

Sourceval fold : f:('a -> 'state -> 'state) -> ('a, 'err) t -> 'state -> ('state, 'err) result

fold ~f stream acc consumes the remainder elements e1, ..., eN of stream and returns Ok (acc |> f e1 |> ... |> f eN) if no error occurred

Sourceval fold_s : f:('a -> 'state -> ('state, 'err) result) -> ('a, 'clog) t -> 'state -> ('state, [> `Congested of 'clog ] as 'err) result

fold_s ~f stream acc consumes the remainder of stream, passing each element in order to f along with the latest accumulation starting at acc, and returning the final accumulation if successful. An error result may be due to either the stream provider or the callback, as distinguished with the `Congested constructor.

Sourceval iter_s : f:('a -> (unit, 'err) result) -> ('a, 'clog) t -> (unit, [> `Congested of 'clog ] as 'err) result

iter_s ~f stream consumes the remainder of stream, passing each element in order to f. An error result may be due to either the steram provider or the callback, as distinguished with the `Congested constructor.

Sourceval to_rev_list : ('a, 'err) t -> ('a list, 'err) result

to_rev_list stream consumes the remainder of stream, returning a list of its element in reverse order of production.

Sourceval to_list : ('a, 'err) t -> ('a list, 'err) result

to_list stream consumes the remainder of stream, returning a list of its element in order of production.

Sourceval of_list : 'a list -> ('a, 'err) t

of_list xs is a non-failing finite stream (re)producing the elements xs in order of occurrence.

Sourceval map_result : f:('a -> ('b, 'err) result) -> ('a, 'err) t -> ('b, 'err) t