Skip to main content
Module

x/fun/fn.ts>id

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

A thunk over the identity function. It allows one to constrain an identity to a specific type.

Examples

Example 1

import { id } from "./fn.ts";

const idString = id<string>(); // (s: string) => string
const idNumber = id<number>(); // (n: number) => number

const result1 = idString("Hello"); // "Hello"
const result2 = idNumber(1); // 1

Returns

Fn<A, A>