package stdune

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

Commutative monoids.

module type Basic = sig ... end
module type S = sig ... end
module Make (M : Basic) : S with type t := M.t

This functor extends the basic definition of a commutative monoid by adding a convenient operator synonym ( @ ) = combine, as well as derived functions reduce and map_reduce.

module Exists : S with type t = bool

The commutative monoid you get with empty = false and combine = ( || ).

module Forall : S with type t = bool

The commutative monoid you get with empty = true and combine = ( && ).

module Unit : S with type t = Unit.t

The trivial commutative monoid with empty = () and combine () () = ().

module Add (M : sig ... end) : S with type t = M.t

The addition monoid with empty = zero and combine = ( + ).

module Mul (M : sig ... end) : S with type t = M.t

The multiplication monoid with empty = one and combine = ( * ).

module Union (M : sig ... end) : S with type t = M.t

The union monoid with empty = M.empty and combine = M.union.

module Product (A : Basic) (B : Basic) : S with type t = A.t * B.t

The product of commutative monoids where pairs are combined component-wise.

module Product3 (A : Basic) (B : Basic) (C : Basic) : S with type t = A.t * B.t * C.t

Same as Product but for 3 commutative monoids.

module Function (A : sig ... end) (M : Basic) : S with type t = A.t -> M.t

Functions that return a commutative monoid form the following commutative monoid:

OCaml

Innovation. Community. Security.