package monads

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

Various function combinators lifted into the Kleisli category.

val id : 'a -> ('a, 'e) M.t

id x a monadic identity function

val ignore : ('a, 'e) M.t -> (unit, 'e) M.t

ignore m computes m and discards the result.

val nothing : unit -> (unit, 'e) M.t

nothing is a computation that does nothing.

val non : ('a -> (bool, 'e) M.t) -> 'a -> (bool, 'e) M.t

non f returns a negation of the function f.

val apply_n_times : n:int -> ('a -> ('a, 'e) M.t) -> 'a -> ('a, 'e) M.t

apply_n_times ~n f creates a chaing of computation of size n made from applications of the same function to its own result.

val compose : ('b -> ('c, 'e) M.t) -> ('a -> ('b, 'e) M.t) -> 'a -> ('c, 'e) M.t

compose f g creates a composition f.g of two function.

OCaml

Innovation. Community. Security.