package caqti
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=b8ea432820154ec095132c4f7b244b06cd8553e0b2035185b844d9c4f30af8bb
sha512=b7e3ad8e6a9b587db2d517e15cd42df2945148f9223b2fa6f4bc2bcdd2709d53549cca4b65e54511d22466e4c9aa7f0b9c17305a07505519d8bf81d95de629b8
doc/caqti.platform/Caqti_platform/Stream/Make/index.html
Module Stream.Make
Source
Constructs a stream for the provided concurrency monad.
Parameters
Signature
val fold :
f:('a -> 'state -> 'state) ->
('a, 'err) t ->
'state ->
('state, 'err) result Fiber.t
fold ~f stream acc
consumes the remainder elements e1
, ..., eN
of stream
and returns Ok (acc |> f e1 |> ... |> f eN)
if no error occurred
val fold_s :
f:('a -> 'state -> ('state, 'err) result Fiber.t) ->
('a, 'clog) t ->
'state ->
('state, [> `Congested of 'clog ] as 'err) result Fiber.t
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.
val iter_s :
f:('a -> (unit, 'err) result Fiber.t) ->
('a, 'clog) t ->
(unit, [> `Congested of 'clog ] as 'err) result Fiber.t
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.
to_rev_list stream
consumes the remainder of stream
, returning a list of its element in reverse order of production.
to_list stream
consumes the remainder of stream
, returning a list of its element in order of production.
of_list xs
is a non-failing finite stream (re)producing the elements xs
in order of occurrence.