Last active
August 29, 2015 14:04
-
-
Save tstone/cf8557f88d5894a23587 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class HttpClient { | |
def GET(url: String)(implicit context: ExecutionContext) = ??? | |
} | |
class SomeService(http: HttpClient = new HttpClient) { | |
def getSomething(implicit context: ExecutionContext) = ??? | |
} | |
class ServiceB { | |
def foo(arg: String)(implicit context: ExecutionContext) = | |
someService.getSomething.map(???) | |
} | |
// --- VS --- | |
class HttpClient(implicit context: ExecutionContext){ | |
def GET(url: String) | |
} | |
class SomeService { | |
def getSomething(implicit client: HttpClient) = ??? | |
} | |
class ServiceB { | |
def foo(arg: String)(implicit client: HttpClient) = | |
someService.getSomething.map(???) | |
} | |
// --- VS --- | |
class SomeService { | |
def getSomething = (client: HttpClient) => ??? | |
} | |
class ServiceB { | |
def foo(arg: String) = someSerivce.getSomething.andThen(???) | |
} | |
class Controller { | |
serviceB.foo("asdf")(client) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment