Monad.Option_syntaxSourceSyntax module for Option. This is intended to be opened locally in functions which use option for control-flow. Within the scope of this module, the code can include binding operators, leading to a let-style syntax.
See also Option
return x is Some x.
fail is None. It is also an alias for Option.none.
return_unit is Some ().
return_nil is Some [].
return_true is Some true.
return_false is Some false.
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 Option-monad computation (yielding to values of the type 'a option option), you need to do so by hand: return (Some …) and return None.
let* is a binding operator alias for Option.bind.
and* is a binding operator alias for both.
let+ is a binding operator alias for Option.map.
and+ is a binding operator alias for both.
both is the joining of two optional non-unit values. both a b is Some (x, y) iff a is Some x and b is Some y.