View on GitHub

OCamlverse

Documenting everything about OCaml

Edit

Monads

Monads in OCaml are generally used in a slightly different way than in other languages. Rather than using >>= for monadic binds, values are generally bound using a ppx with a syntax such as let%bind x = ....

Additionally, as of OCaml 4.08, the language itself contains syntax for calling monadic functions. See this blog post and the OCaml manual on this.

Monadic Synax Extensions

Classic Monads

  • BAP Monads: BAP (Binary Analysis Platform) has an independent and comprehensive monad library. Rather than using a ppx, BAP makes use of Functors to create expressive monad hierarchies.
  • Monadic: A monad transformer library that also uses OCaml’s built-in syntax (e.g. let*).
  • Preface: Preface is an opinionated library designed to facilitate the handling of recurring functional programming idioms in OCaml. Like BAP it use intensively Functors to create expressive monad hierarchies.