Skip to main content
Module

x/fun/mod.ts>set.apply

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

Given a ReadonlySet of functions A -> I and a ReadonlySet return a ReadonlySet by applying every function to every value A.

Examples

Example 1

import * as S from "./set.ts";
import { pipe } from "./fn.ts";

type Person = { name: string, age: number };

const person = (name: string) => (age: number): Person => ({ name, age });

const result = pipe(
  S.wrap(person),
  S.apply(S.wrap("Brandon")),
  S.apply(S.wrap(37)),
); // ReadonlySet<Person>

Parameters

ua: ReadonlySet<A>

Returns

<I>(ufai: ReadonlySet<(a: A) => I>) => ReadonlySet<I>