Skip to main content
Module

x/fun/semigroup.ts>min

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

Create a semigroup fron an instance of Ord that returns that minimum for the type being ordered. This Semigroup functions identically to min from Ord.

Examples

Example 1

import * as SG from "./semigroup.ts";
import * as N from "./number.ts";
import { pipe } from "./fn.ts";

const { concat } = SG.min(N.OrdNumber);

const smallest = pipe(
  0,
  concat(-1),
  concat(10),
  concat(1000),
  concat(5),
  concat(9001)
); // smallest is -1