gt<A> function

bool Function(A first, A second) gt<A>(
  1. Ord<A> O
)

Returns a function that checks if the first argument is greater than the second.

Example:

void main() {
  // Create an Ord instance for integers
  Ord<int> ordInt = fromCompare((x, y) => x.compareTo(y));

  // Create a 'greater than' function for integers using the ordInt instance
  bool Function(int, int) isGreaterThan = gt(ordInt);

  // Check if one integer is greater than the other
  bool result = isGreaterThan(5, 10); // Output: false (5 is not greater than 10)
}

Implementation

bool Function(A first, A second) gt<A>(Ord<A> O) {
  return (A first, A second) => O.compare(first, second) > 0;
}