Skip to main content
Module

x/fun/set.ts>map

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 map
import { map } from "https://deno.land/x/fun@v2.0.0-alpha.6/set.ts";

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>