package sugar

  1. Overview
  2. Docs
include S.Params.Monad
type 'a t

A parametric type representing any OCaml value.

val return : 'a -> 'a t

Creates a constant value in this monad.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Waits for the conclusion of the monad in the left, and then, apply the unwrapped value to the function in the right.

val catch : (unit -> 'a t) -> (exn -> 'a t) -> 'a t

Checks if the monad returned by the thunk raised an exception, and applies the given error handler if necessary.

This function has intentionally the exact signature as Lwt.catch. This means the Lwt module is already a Strict_monad:

let _ =
  (module Lwt: Sugar.Params.Strict_monad)
OCaml

Innovation. Community. Security.