Combiner.Combiner<bigint>Combiner that returns the maximum bigint.
When to use
Use to keep the largest bigint when an API consumes a Combiner.
export const const CombinerMax: Combiner.Combiner<bigint>const CombinerMax: {
combine: (self: A, that: A) => A;
}
Combiner that returns the maximum bigint.
When to use
Use to keep the largest bigint when an API consumes a Combiner.
CombinerMax: import CombinerCombiner.interface Combiner<A>Represents a strategy for combining two values of the same type A. A
Combiner contains a single combine method that takes two values and
returns a merged result. It does not include an identity/empty value; use
Reducer when you need one.
When to use
Use when you need to describe how two values of the same type
merge, pass a reusable combining strategy to library functions like
Struct.makeCombiner or Option.makeCombinerFailFast, or define the
combining step for a Reducer.
Example (Combining numbers with addition)
import { Combiner } from "effect"
const Sum = Combiner.make<number>((self, that) => self + that)
console.log(Sum.combine(3, 4))
// Output: 7
Combiner<bigint> = import CombinerCombiner.function max<A>(
order: Order.Order<A>
): Combiner<A>
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
max(const Order: order.Order<bigint>Provides an Order instance for bigint that allows comparing and sorting BigInt values.
When to use
Use when you need to sort or compare bigint values through APIs that accept
an ordering instance.
Example (Comparing bigints with Order)
import { BigInt } from "effect"
const a = 123n
const b = 456n
const c = 123n
console.log(BigInt.Order(a, b)) // -1 (a < b)
console.log(BigInt.Order(b, a)) // 1 (b > a)
console.log(BigInt.Order(a, c)) // 0 (a === c)
Order)