Skip to content

Instantly share code, notes, and snippets.

@tpolecat
Last active December 17, 2015 16:29
Show Gist options
  • Save tpolecat/5639490 to your computer and use it in GitHub Desktop.
Save tpolecat/5639490 to your computer and use it in GitHub Desktop.
scala> import Ordering.Implicits._
import Ordering.Implicits._
scala> :pa
// Entering paste mode (ctrl-D to finish)
case class A(n:Int, s:String)
object A {
implicit val ord = Ordering.by(unapply)
}
// Exiting paste mode, now interpreting.
defined class A
defined module A
scala> A(1, "foo") < A(2, "bar")
res0: Boolean = true
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment