Skip to content

Instantly share code, notes, and snippets.

@propensive
Created November 8, 2016 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save propensive/2a357091a014108f5313db700ed23ac9 to your computer and use it in GitHub Desktop.
Save propensive/2a357091a014108f5313db700ed23ac9 to your computer and use it in GitHub Desktop.
Welcome to Scala 2.12.0-M5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions for evaluation. Or try :help.
scala> case class Foo(x: Int)
defined class Foo
scala> implicit def foo: Foo = Foo(1)
foo: Foo
scala> implicitly[Foo]
res0: Foo = Foo(1)
scala> implicit def foo: Foo = Foo(2)
foo: Foo
scala> implicitly[Foo]
res1: Foo = Foo(2)
scala> implicit def foo2: Foo = Foo(3)
foo2: Foo
scala> implicitly[Foo]
<console>:18: error: ambiguous implicit values:
both method foo of type => Foo
and method foo2 of type => Foo
match expected type Foo
implicitly[Foo]
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment