import { set } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { getUnionMonoid } = set;
Given an instance of Eq create a Monoid<ReadonlySet> where concat creates a union of two ReadonlySets.
Examples
Example 1
Example 1
import * as S from "./set.ts";
import * as N from "./number.ts";
import * as M from "./monoid.ts";
import { pipe } from "./fn.ts";
const monoid = S.getUnionMonoid(N.EqNumber);
const concatAll = M.concatAll(monoid);
const result1 = concatAll([
S.set(1, 2, 3),
S.set(4, 5, 6),
S.set(1, 3, 5, 7)
]); // Set(1, 2, 3, 4, 5, 6, 7)
const result2 = concatAll([]); // Set()
const result3 = concatAll([S.empty()]); // Set()
Parameters
S: Eq<A>