Skip to content

Instantly share code, notes, and snippets.

@vega113
Created November 30, 2013 06:52
Show Gist options
  • Save vega113/7716156 to your computer and use it in GitHub Desktop.
Save vega113/7716156 to your computer and use it in GitHub Desktop.
Extend existing companion object
implicit class FutureCompanionOps(f: Future.type) extends AnyVal {
def userInput(message: String): Future[String] = Future {
readLine(message)
}
}
class FutureCompanionOps(f: Future.type) extends AnyVal {
def userInput(message: String): Future[String] = Future {
readLine(message)
}
}
implicit def f2ops(f: Future.type) = new FutureCompanionOps(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment