Max

monoid. Max

new Max()

The Max monoid. Max can be used to find the largest item from multiple items by concatenation

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

Max(1); // -> Max(1)

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

Extends

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

Methods

(static) empty() → {Max}

Monoid implementation for Max. Returns a Max of negative Infinity

Source:
Returns:
Type:
Max

The empty Max

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

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

(static) of(a) → {Max}

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

Source:
Parameters:
Name Type Description
a any

The value to lift

Returns:
Type:
Max

A new Max

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

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

concat(a) → {Max}

Concatenates a Max with another using Ord.gt comparison

Source:
Parameters:
Name Type Description
a Max

The Max instance to concatenate with

Returns:
Type:
Max

A new Max

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

const max = Max(3);

max.concat(Max(2)); // -> Max(3)