Last active
August 29, 2015 14:06
-
-
Save cvogt/81eeaf0a48c7810442ac to your computer and use it in GitHub Desktop.
TMap with mutual dependencies
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
// ideal world, where every library has a tmap enabled monadic interface: | |
object Dep1Lib{ | |
def doSomeThing = for{ | |
dep1context <- Implicit[Dep1Context] | |
dep3context <- Implicit[Dep3Context] | |
} yield /* ... do something ... */ | |
} | |
object Dep3Lib{ | |
def doSomeThingElse = for{ | |
dep3context <- Implicit[Dep3Context] | |
dep1context <- Implicit[Dep1Context] | |
} yield /* ... do something ... */ | |
} | |
val dep1 = new Dep1Context | |
val dep3 = new Dep3Context | |
val deps = TMap(dep1) ++ TMap(dep3) | |
object Dep1.doSomeThing(deps) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment