import { set } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { compact } = set;
Given an instance of Eq create a function that will take a ReadonlySet and return a new ReadonlySet where any members that are equal are deduplicated.
Examples
Example 1
Example 1
import * as S from "./set.ts";
import * as N from "./number.ts";
import * as E from "./eq.ts";
const eq = E.struct({ num: N.EqNumber });
const compact = S.compact(eq);
const set = S.set({ num: 1 }, { num: 1 }, { num: 2 });
// Set({ num: 1 }, { num: 1 }, { num: 2 })
const result = compact(set); // Set({ num: 1 }, { num: 2 })
Parameters
S: Eq<A>