Skip to content

Instantly share code, notes, and snippets.

@tpolecat
Created July 31, 2013 15:01
Show Gist options
  • Save tpolecat/6122745 to your computer and use it in GitHub Desktop.
Save tpolecat/6122745 to your computer and use it in GitHub Desktop.
scala> trait X { type A }
defined trait X
scala> implicit def convert(a:X)(implicit ev: a.A =:= String): Int = 42
convert: (a: X)(implicit ev: =:=[a.A,String])Int
scala> (new X {}) : Int
<console>:10: error: Cannot prove that a.A =:= String.
(new X {}) : Int
^
scala> (new X { type A = String }) : Int
res11: Int = 42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment