Skip to main content
Module

x/fun/set.ts>getCombinableSet

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function getCombinableSet
import { getCombinableSet } 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.getCombinableSet(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

Combinable<ReadonlySet<A>>