import { semigroup } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { concatAll } = semigroup;
Given a semigroup, create a function that will iterate through an array of values and concat them. This is not much more than Array.reduce(concat).
Examples
Example 1
Example 1
import * as SG from "./semigroup.ts";
import * as N from "./number.ts";
import { pipe } from "./fn.ts";
const sumAll = SG.concatAll(N.SemigroupNumberSum);
const sum = pipe(
[1, 30, 80, 1000, 52, 42],
sumAll(0),
); // sum === 1205