Min

monoid. Min

new Min()

The Min monoid. Min can be used to find the smallest item from multiple items by concatenation

Version:
  • 3.0.0
Source:
Example
const {Min} = require('futils').monoid;

Min(1); // -> Min(1)

Min(1).value; // -> 1

Extends

  • module:generics/Show
  • module:generics/Eq
  • module:generics/Ord

Methods

(static) empty() → {Min}

Monoid implementation for Min. Returns a Min of Infinity

Source:
Returns:
Type:
Min

The empty Min

Example
const {Min} = require('futils').monoid;

Min.empty(); // -> Min(Infinity)

(static) of(a) → {Min}

Lifts a value into a Min. Returns a Min of Infinity if the value isn't a number

Source:
Parameters:
Name Type Description
a any

The value to lift

Returns:
Type:
Min

A new Min

Example
const {Min} = require('futils').monoid;

Min.of(1);    // -> Min(1)
Min.of(null); // -> Min(Infinity)
Min.of({});   // -> Min(Infinity)

concat(a) → {Min}

Concatenates a Min with another using Ord.lt comparison

Source:
Parameters:
Name Type Description
a Min

The Min instance to concatenate with

Returns:
Type:
Min

A new Min

Example
const {Min} = require('futils').monoid;

const min = Min(3);

min.concat(Min(2)); // -> Min(2)