Skip to main content
Module

x/fun/mod.ts>set.getInitializableSet

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

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()

Parameters

C: Comparable<A>

Returns

Initializable<ReadonlySet<A>>