Legend:
Library
Module
Module type
Parameter
Class
Class type
A delayed computation that can produce a deferred.
Nothing happens with a lazy deferred unless one forces it. Forcing a lazy deferred starts the computation, which will eventually cause the deferred to become determined. As usual with laziness, multiply forcing a lazy deferred is no different than forcing it a single time.
Exceptions (both synchronous and asynchronous) raised by a delayed computation are returned by force (wait, peek, etc.), or will be raised to the monitor in effect when force_exn (wait_exn, peek_exn, etc.) was called.
The type is not exposed nor defined as 'a Deferred.t Lazy.t or 'a Or_error.t
Deferred.t Lazy.t, because there is a difference in power with these types. There is no way in standard OCaml to hook an asynchronous computation to be triggered when a lazy value gets computed. This functionality is offered by this module (see wait). Plus, dealing with an exception raised by the closures provided is slightly easier when done consistently through this API.
There is no val of_lazy : 'a Deferred.t Lazy.t -> 'a t because of the difference in power.
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.
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 Pervasives.ignore. Some monads still do let ignore = ignore_m for historical reasons.