package async_kernel
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=01ced973dbc70535f692f38bed524ae82dba17e26e58791b2fbf0d647b160d2e
doc/async_kernel.eager_deferred/Eager_deferred/index.html
Module Eager_deferred
Source
include S with type 'a t := 'a Async_kernel.Deferred.t
include Async_kernel.Invariant.S1 with type 'a t := 'a Async_kernel.Deferred.t
include Core.Monad with type 'a t := 'a Async_kernel.Deferred.t
val (>>=) :
'a Async_kernel.Deferred.t ->
('a -> 'b Async_kernel.Deferred.t) ->
'b Async_kernel.Deferred.t
t >>= f
returns a computation that sequences the computations represented by two monad elements. The resulting computation first does t
to yield a value v
, and then runs the computation returned by f v
.
t >>| f
is t >>= (fun a -> return (f a))
.
val bind :
'a Async_kernel.Deferred.t ->
f:('a -> 'b Async_kernel.Deferred.t) ->
'b Async_kernel.Deferred.t
bind t ~f
= t >>= f
return v
returns the (trivial) computation that returns v.
map t ~f
is t >>| f.
join t
is t >>= (fun t' -> t')
.
ignore_m t
is map t ~f:(fun _ -> ())
. ignore_m
used to be called ignore
, but we decided that was a bad name, because it shadowed the widely used Stdlib.ignore
. Some monads still do let ignore = ignore_m
for historical reasons.
Like all
, but ensures that every monadic value in the list produces a unit value, all of which are discarded rather than being collected into a list.
These are convenient to have in scope when programming with a monad:
val both :
'a Async_kernel.Deferred.t ->
'b Async_kernel.Deferred.t ->
('a * 'b) Async_kernel.Deferred.t
val repeat_until_finished :
'state ->
('state ->
[ `Repeat of 'state | `Finished of 'result ] Async_kernel.Deferred.t) ->
'result Async_kernel.Deferred.t
module List :
Async_kernel.Monad_sequence.S
with type 'a monad := 'a Async_kernel.Deferred.t
with type 'a t := 'a list
module Queue :
Async_kernel.Monad_sequence.S
with type 'a monad := 'a Async_kernel.Deferred.t
with type 'a t := 'a Core.Queue.t
Similar to Deferred.Queue
but eager when passing ~how:`Sequential. The functions in Queue
raise if the queue is mutated during execution.
module Memo :
Async_kernel.Deferred.Memo.S
with type 'a deferred := 'a Async_kernel.Deferred.t