package sugar
Module Promise.MakeSource
A parametric module that implements the monadic interface for values. The complete documentation can be found in Sugar.S.Promise.
Parameters
module UserError : S.Params.Strict_errormodule UserMonad : S.Params.Strict_monadSignature
include S.Promise
with type error := UserError.t
with type 'a monad := 'a UserMonad.t
with type 'a value = ('a, UserError.t) Result.result
with type 'a result = ('a, UserError.t) Result.result UserMonad.t
An alias for Pervasives.result that can only work with errors of your project.
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.
Similar to S.Result.bind_unless
Similar to S.Result.throw
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.
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.
Extracts a successful value from an computation, or raises and Invalid_arg exception with a customized error message.
module NoExceptions :
S.Promise with type error := UserError.t and type 'a monad := 'a UserMonad.tDisable exception handling. Open this module with you don't want to catch exceptions.