Create a new result module based on the current one, but wrapped around a monad.
type 'a monad
This type is an alias to the underlining monad used to create your Promise
module.
In other words, it points to the main type of your threading library (Lwt.t
for Lwt,
or Async.Std.Deferred.t
for Async).
This type describes a result monad inside a project.
For example, if the concrete module is built on top of Lwt,
a value of type unit result
will be translated as (unit, error) Pervasives.result Lwt.t
.
This combinator is also called bind
.
It can be used to chain sequential operations with the current monad. If the computation in the left failed, the operator will propagate the error, skipping the function completely.
module Infix : sig ... end
Unwraps the successful value as a normal value in the threading monad.
If the value is not successful, it will raise an Invalid_arg
exception.