Last active
October 17, 2017 11:21
-
-
Save bergmark/99acc470b74db5b59ab6f23da48ea1ca to your computer and use it in GitHub Desktop.
This file contains 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
trait Foo[A] | |
object A { | |
implicit val foo: Foo[Int] = new Foo[Int] {} | |
} | |
object B { | |
implicit val foo: Foo[String] = new Foo[String] {} | |
} | |
object C { | |
import A._ | |
import B._ | |
// Whoops, the implicits have the same name so neither will resolve. | |
implicitly[Foo[Int]] | |
implicitly[Foo[String]] | |
} |
This file contains 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
trait Foo[A] | |
case class A() | |
object A { | |
implicit val foo: Foo[A] = new Foo[A] {} | |
} | |
case class B() | |
object B { | |
implicit val foo: Foo[B] = new Foo[B] {} | |
} | |
object C { | |
implicitly[Foo[A]] | |
implicitly[Foo[B]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment