In addition to Order, Cats also defines PartialOrder.

scala> import cats._, cats.instances.all._, cats.syntax.partialOrder._
import cats._
import cats.instances.all._
import cats.syntax.partialOrder._

scala> 1 tryCompare 2
res0: Option[Int] = Some(-1)

scala> 1.0 tryCompare Double.NaN
res1: Option[Int] = Some(-1)

PartialOrder enables tryCompare syntax which returns Option[Int]. According to algebra, it’ll return None if operands are not comparable. It’s returning Some(-1) when comparing 1.0 and Double.NaN, so I’m not sure when things are incomparable.

scala> def lt[A: PartialOrder](a1: A, a2: A): Boolean = a1 <= a2
lt: [A](a1: A, a2: A)(implicit evidence$1: cats.PartialOrder[A])Boolean

scala> lt[Int](1, 2.0)
<console>:22: error: type mismatch;
 found   : Double(2.0)
 required: Int
       lt[Int](1, 2.0)

scala> lt(1, 2)
res3: Boolean = true

PartialOrder also enables >, >=, <, and <= operators, but these are tricky to use because if you’re not careful you could end up using the built-in comparison operators.