Created
February 9, 2017 00:31
-
-
Save chenharryhua/9ede05d8fdf3b26984e07e762f65129e 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
import scala.concurrent.ExecutionContext | |
import scala.concurrent.Future | |
object ImplicitInjection { | |
final class Foo(implicit ec: ExecutionContext){ | |
def foo = Future(1).map(_ + 1) | |
} | |
trait Bar { | |
implicit val ec : ExecutionContext | |
def bar = Future(1).map(_ + 1) | |
} | |
object Baz { | |
def baz(implicit ec: ExecutionContext) = Future(1).map(_ + 1) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
three ways to bring ExecutionContext into scope.