Skip to main content
Module

x/fun/monoid.ts>Monoid

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
interface Monoid
implements Semigroup<T>
import { type Monoid } from "https://deno.land/x/fun@v.2.0.0-alpha.11/monoid.ts";

A Monoid is an algebra with a notion of emptiness. In addition to this it extends the algebra of a Semigroup. This means that an instance of Monoid has the methods empty and concat.

An instance of Monoid must obey the following laws:

  1. Associativity: pipe(a, concat(b), concat(c)) === pipe(a, concat(pipe(b, concat(c))))
  2. Right identity: concat(a)(empty()) === a
  3. Left identity: concat(M.empty())(a) === a

The original type came from static-land

Properties

readonly
empty: () => T