Skip to content

Instantly share code, notes, and snippets.

@bergmark
Last active October 17, 2017 11:21
Show Gist options
  • Save bergmark/99acc470b74db5b59ab6f23da48ea1ca to your computer and use it in GitHub Desktop.
Save bergmark/99acc470b74db5b59ab6f23da48ea1ca to your computer and use it in GitHub Desktop.
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]]
}
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