There is Equal
object in scalaz
package:
package scalaz
object Equal extends EqualLow {
// ...
implicit def Tuple3Equal[A: Equal, B: Equal, C: Equal]: Equal[(A, B, C)] = equal {
case ((a1, b1, c1), (a2, b2, c2)) => a1 ≟ a2 && b1 ≟ b2 && c1 ≟ c2
}
//...
}
How it is possible that compiler knows, that implicit def Tuple3Equal
method will be called when I call:
import scalaz._
import Scalaz._
implicitly[Equal[Tuple3[Int,Int,Int]]]
//or
(1,2,3).=== (1,2,3)
Note that, I am importing only scalaz._
package and Scalaz._
object and there is no explicit import scalaz.Equal._ which contains implicits.