import { type Semigroup } from "https://deno.land/x/fun@v2.0.0-alpha.6/semigroup.ts";
A Semigroup is an algebra with a notion of concatenation. This means that it's used to merge two Ts into one T. The only rule that this merging must follow is that if you merge A, B, and C, that it doesn't matter if you start by merging A and B or start by merging B and C. There are many ways to merge values that follow these rules. A simple example is addition for numbers. It doesn't matter if you add (A + B) + C or if you add A + (B + C). The resulting sum will be the same. Thus, (number, +) can be used to make a Semigroup (see SemigroupNumberSum for this exact instance).
An instance of concat must obey the following laws:
- Associativity: pipe(a, concat(b), concat(c)) === pipe(a, concat(pipe(b, concat(c))))
The original type came from static-land