Slide 51
Slide 51 text
3. Multi-parameter Type Classes (Add[A, B, C])
trait Add[A, B, C] {
def +(a: A, b: B): C
}
implicit val intAdd1: Add[Int, Int, Double] =
(a: Int, b: Int) => a + b
implicit val intAdd2: Add[Int, Int, Int] =
(a: Int, b: Int) => a + b
1 + 2 = 3.0
Instead of 3