package preface

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

A Monoid is a type t which provides a binary associative operation combine and a neutral element (neutral). In other words, a Monoid is a Semigroup with a neutral element.

Laws

To ensure that the derived combiners work properly, a functor should respect these laws:

  1. combine (combine a b) c = combine a (combine b c) (from Semigroup)
  2. combine x neutral = combine neutral x = x

Minimal definition

module type WITH_NEUTRAL = sig ... end

A type t with a neutral element. This signature is mainly used to enrich a Semigroup with a neutral element.

module type WITH_NEUTRAL_AND_COMBINE = sig ... end

Structure anatomy

module type CORE = WITH_NEUTRAL_AND_COMBINE

Basis operations.

module type OPERATION = sig ... end

Additional operations.

module type INFIX = sig ... end

Infix operators.

Complete API

module type API = sig ... end

The complete interface of a Monoid.

Additional references

OCaml

Innovation. Community. Security.