package sugar
Module type S.PromiseSource
type 'a value = ('a, error) Result.resultAn alias for Pervasives.result that can only work with errors of your project.
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.
val return : 'a -> 'a resultSimilar to S.Result.return
module Infix : sig ... endUnwraps the successful value as a normal value in the threading monad. If the value is not successful, it will raise an Invalid_arg exception.
Unwraps the successful value as a value in the threading monad. Different from unwrap, you can assign an error handler to be executed if the computation failed.