package octez-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Monad extends the Applicative type class with a new function join. join takes a value in a nested context a t t and joins them together so that we have a single context a t.

We can define let* in terms of join and vice versa:

let ( let* ) x f = join (map f x)
let join x =
  let* y = x in
  y

assuming

( let* ) = bind .

A Monad should satisfy:

  • Associativity: (f >=> g) >=> h = f >=> (g >=> h)
  • Identities: return >=> f = f = f >=> return

assuming

( let* ) = bind .

and

f >=> g =
fun x ->
  let* y = f x in
  let* z = g y in
  return z
module type S = sig ... end
module Syntax (M : S) : sig ... end

Utility to import let-syntax for any Monad.

OCaml

Innovation. Community. Security.