Created
September 16, 2011 13:14
-
-
Save missingfaktor/1222095 to your computer and use it in GitHub Desktop.
Typesafe equals from Scalaz
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> case class Person(ssn: Long, name: String, age: Int) | |
| defined class Person | |
| scala> implicit val e = implicitly[Equal[Long]] contramap ((_ : Person).ssn) | |
| e: scalaz.Equal[Person] = scalaz.Equals$$anon$2@19e8fc5 | |
| scala> val p = Person(32323L, "Rahul", 21) | |
| p: Person = Person(32323,Rahul,21) | |
| scala> p === p | |
| res59: Boolean = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment