Skip to content

Instantly share code, notes, and snippets.

@itang
Created July 13, 2011 08:29
Show Gist options
  • Save itang/1079929 to your computer and use it in GitHub Desktop.
Save itang/1079929 to your computer and use it in GitHub Desktop.
scala> def a[T](i:T)(implicit ev: =:=[String, T]) = println(i)
a: [T](i: T)(implicit ev: =:=[String,T])Unit
scala> def test[T <: Any](a : T)(implicit ev : T =:= String) = println(a)
test: [T](a: T)(implicit ev: =:=[T,String])Unit
scala> test("aa")
aa
scala> test(1)
<console>:12: error: Cannot prove that Int =:= String.
test(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment