Finding the second matching implicit
问题 Consider the following setup: trait Foo[A] object Foo extends Priority2 trait Priority0 { implicit def foo1: Foo[Int] = new Foo[Int] {} } trait Priority1 extends Priority0 { implicit def foo2: Foo[Boolean] = new Foo[Boolean] {} } trait Priority2 extends Priority1 { implicit def foo3: Foo[Double] = new Foo[Double] {} } Now, in a REPL (having loaded the above code up), I can do the following: scala> def implicitlyFoo[A](implicit foo: Foo[A]) = foo implicitlyFoo: [A](implicit foo: Foo[A])Foo[A]