Skip to content

Instantly share code, notes, and snippets.

@nuclearace
Last active November 3, 2015 21:22
Show Gist options
  • Select an option

  • Save nuclearace/20a9d69f2abc50690882 to your computer and use it in GitHub Desktop.

Select an option

Save nuclearace/20a9d69f2abc50690882 to your computer and use it in GitHub Desktop.
object Main extends App {
implicit val queue: dispatch.queue = "goodbyeQueue"
def sayHello = () => {println("hello")}
def sayGoodbye = () => {println("goodbye")}
dispatch.async(sayHello)("helloQueue")
dispatch async sayGoodbye
}
object dispatch {
type queue = String
def async(cb: () => Unit)(implicit queue: queue) = {
println(s"Executing in $queue")
cb()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment