Skip to main content
Module

x/fun/mod.ts>semigroup.max

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

Create a semigroup fron an instance of Ord that returns that maximum for the type being ordered. This Semigroup functions identically to max 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.max(N.OrdNumber);

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

Parameters

ord: Ord<A>