LYAHFGG:
Ordは、何らかの順序を付けられる型のための型クラスです。Ordはすべての標準的な大小比較関数、>、<、>=、<=をサポートします。
Cats で Ord に対応する型クラスは Order だ。
// plain Scala
1 > 2.0
// res0: Boolean = false
import cats._, cats.syntax.all._
1 compare 2.0
// error: type mismatch;
// found : Double(2.0)
// required: Int
// 1.0 compare 2.0
// ^^^
import cats._, cats.syntax.all._
1.0 compare 2.0
// res2: Int = -1
1.0 max 2.0
// res3: Double = 2.0
Order は Int (負、ゼロ、正) を返す compare 演算を可能とする。
また、minx と max 演算子も可能とする。
Eq 同様、Int と Double の比較はコンパイルを失敗させる。