Hyperlinkv0.8.0-beta.28

Order

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

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

When to use

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

Details

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

Example (Checking greater-than comparisons)

import { Order } from "effect"

const isGreaterThanNumber = Order.isGreaterThan(Order.Number)

console.log(isGreaterThanNumber(2, 1)) // true
console.log(isGreaterThanNumber(1, 2)) // false
console.log(isGreaterThanNumber(1, 1)) // false
Source effect/Order.ts:6964 lines
export const isGreaterThan = <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 7 symbols