cats.kernel

PartialOrder

trait PartialOrder[A] extends Eq[A]

The PartialOrder type class is used to define a partial ordering on some type A.

A partial order is defined by a relation <=, which obeys the following laws:

- x <= x (reflexivity) - if x <= y and y <= x, then x = y (anti-symmetry) - if x <= y and y <= z, then x <= z (transitivity)

To compute both <= and >= at the same time, we use a Double number to encode the result of the comparisons x <= y and x >= y. The truth table is defined as follows:

x <= y x >= y Double true true = 0.0 (corresponds to x = y) false false = NaN (x and y cannot be compared) true false = -1.0 (corresponds to x < y) false true = 1.0 (corresponds to x > y)

Self Type
PartialOrder[A]
Linear Supertypes
Eq[A], Serializable, Serializable, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. PartialOrder
  2. Eq
  3. Serializable
  4. Serializable
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def getClass(): Class[_]

    Definition Classes
    Any
  2. abstract def partialCompare(x: A, y: A): Double

    Result of comparing x with y.

    Result of comparing x with y. Returns NaN if operands are not comparable. If operands are comparable, returns a Double whose sign is: - negative iff x < y - zero iff x = y - positive iff x > y

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  2. final def ##(): Int

    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def equals(arg0: Any): Boolean

    Definition Classes
    Any
  6. def eqv(x: A, y: A): Boolean

    Returns true if x = y, false otherwise.

    Returns true if x = y, false otherwise.

    Definition Classes
    PartialOrderEq
  7. def gt(x: A, y: A): Boolean

    Returns true if x > y, false otherwise.

  8. def gteqv(x: A, y: A): Boolean

    Returns true if x >= y, false otherwise.

  9. def hashCode(): Int

    Definition Classes
    Any
  10. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  11. def lt(x: A, y: A): Boolean

    Returns true if x < y, false otherwise.

  12. def lteqv(x: A, y: A): Boolean

    Returns true if x <= y, false otherwise.

  13. def neqv(x: A, y: A): Boolean

    Returns false if x and y are equivalent, true otherwise.

    Returns false if x and y are equivalent, true otherwise.

    Definition Classes
    Eq
  14. def partialComparison(x: A, y: A): Option[Comparison]

    Like partialCompare, but returns a cats.kernel.Comparison instead of an Double.

    Like partialCompare, but returns a cats.kernel.Comparison instead of an Double. Has the benefit of being able to pattern match on, but not as performant.

  15. def pmax(x: A, y: A): Option[A]

    Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.

  16. def pmin(x: A, y: A): Option[A]

    Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.

  17. def toString(): String

    Definition Classes
    Any
  18. def tryCompare(x: A, y: A): Option[Int]

    Result of comparing x with y.

    Result of comparing x with y. Returns None if operands are not comparable. If operands are comparable, returns Some[Int] where the Int sign is: - negative iff x < y - zero iff x = y - positive iff x > y

Inherited from Eq[A]

Inherited from Serializable

Inherited from Serializable

Inherited from Any

Ungrouped