Legend:
Library
Module
Module type
Parameter
Class
Class type
Syntax module for Lwt+Option. This is intended to be opened locally in functions which use Lwt and option for control-flow. Within the scope of this module, the code can include binding operators, leading to a let-style syntax.
Note that we do not provide return_some nor return_none. Both of these functions are possible but somewhat confusing and rarely useful in practice. If you need to carry options within a LwtOption-monad computation (yielding values of the type 'a option option Lwt.t), you need to do so by hand: return (Some …) and return (None).
val and+ : 'a optionLwt.t->'b optionLwt.t->('a * 'b) optionLwt.t
and* is a binding operator alias for both.
The following values are for mixing expressions that are Lwt-only or Option-only within the Lwt option monad. Note that there are fundamental differences between option and Lwt.t: the former can be simply matched on (i.e., it is possible to get out of the monad at any point) whereas the latter can only be bound on (i.e., it is not possible to get out of the monad). In addition, the former is for aborting computations on failures (which in this case means that no value can be produced) whereas the latter is for waiting before continuing.
Still, from a syntax point-of-view, both are handled the same way: with a specialised binding operator.