Last active
December 17, 2015 16:29
-
-
Save tpolecat/5639490 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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