Hyperlinkv0.8.0-beta.28

Order

Order.isLessThanconsteffect/Order.ts:662
<A>(O: Order<A>): {
  (that: A): (self: A) => boolean
  (self: A, that: A): boolean
}

Checks whether one value is strictly less than another according to the given order.

When to use

Use when you need a boolean less-than predicate using an Order.

Details

Returns true if the order returns -1, meaning the first value is less than the second. Equal or greater values return false.

Example (Checking less-than comparisons)

import { Order } from "effect"

const isLessThanNumber = Order.isLessThan(Order.Number)

console.log(isLessThanNumber(1, 2)) // true
console.log(isLessThanNumber(2, 1)) // false
console.log(isLessThanNumber(1, 1)) // false
Source effect/Order.ts:6624 lines
export const isLessThan = <A>(O: Order<A>): {
  (that: A): (self: A) => boolean
  (self: A, that: A): boolean
} => dual(2, (self: A, that: A) => O(self, that) === -1)
Referenced by 8 symbols