package stdune

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

Module Monoid.CommutativeSource

Commutative monoids.

Sourcemodule type Basic = sig ... end
Sourcemodule type S = sig ... end
Sourcemodule 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.

Sourcemodule Exists : S with type t = bool

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

Sourcemodule Forall : S with type t = bool

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

Sourcemodule Unit : S with type t = Unit.t

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

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

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

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

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

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

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

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

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

Sourcemodule 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.

Sourcemodule 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.