Skip to content

Instantly share code, notes, and snippets.

@non
Created November 9, 2012 03:38
Show Gist options
  • Select an option

  • Save non/4043553 to your computer and use it in GitHub Desktop.

Select an option

Save non/4043553 to your computer and use it in GitHub Desktop.
scala> trait Foo[A] {
| type Bar
| def bar: Bar
|
| type Qux
| def qux: Qux
| }
defined trait Foo
scala> object IntHasFoo extends Foo[Int] {
| type Bar = Long
| def bar = 999L
| type Qux = Double
| def qux = 9.99
| }
defined module IntHasFoo
scala> IntHasFoo.bar
res0: Long = 999
scala> def blah[A](a:A)(implicit ev:Foo[A]) = (a, ev.bar, ev.qux)
<console>:8: error: illegal dependent method type
def blah[A](a:A)(implicit ev:Foo[A]) = (a, ev.bar, ev.qux)
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment