package coq

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

A definition of monads, each of the combinators is used in the Make functor.

type +'a t
val return : 'a -> 'a t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val (>>) : unit t -> 'a t -> 'a t
val map : ('a -> 'b) -> 'a t -> 'b t

The monadic laws must hold:

  • (x>>=f)>>=g = x>>=fun x' -> (f x'>>=g)
  • return a >>= f = f a
  • x>>=return = x

As well as the following identities:

  • x >> y = x >>= fun () -> y
  • map f x = x >>= fun x' -> f x'