Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/set.ts>getInitializableSet

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function getInitializableSet
import { getInitializableSet } from "https://deno.land/x/fun@v2.0.0/set.ts";

Given an instance of Comparable create a Combinable<ReadonlySet> where combine creates a union of two ReadonlySets.

Examples

Example 1

import * as S from "./set.ts";
import * as N from "./number.ts";
import * as M from "./combinable.ts";
import { pipe } from "./fn.ts";

const monoid = S.getInitializableSet(N.ComparableNumber);
const combineAll = M.getCombineAll(monoid);

const result1 = combineAll(
  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 result3 = combineAll(S.init()); // Set()

Returns

Initializable<ReadonlySet<A>>