Skip to main content
Module

x/fun/mod.ts>semigroup.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 semigroup.min
import { semigroup } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { min } = semigroup;

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

Parameters

ord: Ord<A>