Skip to content

Instantly share code, notes, and snippets.

@eyston
Created October 10, 2011 22:16
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 eyston/1276743 to your computer and use it in GitHub Desktop.
Save eyston/1276743 to your computer and use it in GitHub Desktop.
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