Skip to content

Instantly share code, notes, and snippets.

@non
Created February 10, 2012 23:44
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 non/1794165 to your computer and use it in GitHub Desktop.
Save non/1794165 to your computer and use it in GitHub Desktop.
import scala.{specialized => spec}
class Foo[@spec(Int) A](val a:A) {
def sink(x:A) = ()
def bar[@spec(Int) B](b:B):Int = {
sink(a)
99
}
}
object Main {
def z1(a:Int, b:Int) = new Foo(a).bar(b)
def z2(a:Int, b:String) = new Foo(a).bar(b)
def z3(a:String, b:Int) = new Foo(a).bar(b)
def z4(a:String, b:String) = new Foo(a).bar(b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment