Created
October 10, 2011 22:16
-
-
Save eyston/1276743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Greeting = () => String | |
def greet(g: Greeting) = { | |
println(g()) | |
} | |
def hello() = { "hello from Huey" } | |
greet(hello) // >> "hello from Huey" | |
type Greeter = { def greet() } | |
def greet(g: Greeter) = { | |
g.greet() | |
} | |
object Hello { | |
def greet() = { println "hello, again, from Huey" } | |
} | |
greet(Hello) // >> "hello, again, from Huey" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment