Skip to main content Link Search Menu Expand Document (external link)

Ordering overview

Added in v0.24.0


Table of contents


instances

Monoid

Monoid instance for Ordering, returns the left-most non-zero Ordering.

The empty value is 0.

Signature

export declare const Monoid: monoid.Monoid<Ordering>

Example

import { Monoid } from "@effect/typeclass/data/Ordering"

assert.deepStrictEqual(Monoid.combine(Monoid.empty, -1), -1)
assert.deepStrictEqual(Monoid.combine(Monoid.empty, 1), 1)
assert.deepStrictEqual(Monoid.combine(1, -1), 1)

Added in v0.24.0

Semigroup

Semigroup instance for Ordering, returns the left-most non-zero Ordering.

Signature

export declare const Semigroup: semigroup.Semigroup<Ordering>

Example

import { Semigroup } from "@effect/typeclass/data/Ordering"

assert.deepStrictEqual(Semigroup.combine(0, -1), -1)
assert.deepStrictEqual(Semigroup.combine(0, 1), 1)
assert.deepStrictEqual(Semigroup.combine(1, -1), 1)

Added in v0.24.0