Skip to main content
Module

x/fun/mod.ts>set.map

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

Given a function A -> I and a ReadonlySet return a new ReadonlySet where the values were created by passing each A through the A -> I function.

Examples

Example 1

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

const set = S.set("hello", "world", "goodbye");

const result = pipe(
  set,
  S.map(s => s.length),
); // Set(5, 7);

Parameters

fai: (a: A) => I

Returns

(ua: ReadonlySet<A>) => ReadonlySet<I>