Skip to main content
Module

x/fun/fn.ts>constant

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

Create a Fn that always returns a value. This is equivalent to of but without the ability to specify a contravariant argument.

Examples

Example 1

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

const alwaysA = constant("A");

const result = alwaysA(); // "A"

Returns

() => A