effect-io-ai

Package: effect
Module: Combiner

Combiner.max

Creates a Combiner that returns the larger of two values according to the provided Order.

When to use

Use when you want to accumulate the maximum value across a collection or build a Reducer that tracks the running maximum.

Details

The combiner compares values using the given Order. When values are equal, it returns that (the second argument).

Example (Selecting the maximum of two numbers)

import { Combiner, Number } from "effect"

const Max = Combiner.max(Number.Order)

console.log(Max.combine(3, 1))
// Output: 3

console.log(Max.combine(1, 3))
// Output: 3

See

Signature

declare const max: <A>(order: Order.Order<A>) => Combiner<A>

Source

Since v4.0.0