hakobe (owner)

Revisions

gist: 146923 Download_button fork
public
Public Clone URL: git://gist.github.com/146923.git
Embed All Files: show embed
contra_variant.scala #
1
2
3
4
5
6
7
8
9
10
11
12
class Applyer[-A, +B]( f :(A => B)) {
    def apply(x:A) :B = {
        this.f(x)
    }
}
 
val a = new Applyer[String, int]( {x :AnyRef => x.hashCode} )
println(
    a.apply("hello")
)