You can group those dependencies to have the same ...
# arrow
s
You can group those dependencies to have the same effect.
data class UseCaseContext(val repo: Repo, val db: Db)
, now your use cases logic is coupled to
UseCaseContext
and you can deal with your dependencies further as you normally would. Interface segregation etc
i
Yeah for sure, but still you need to provide the instances of those dependencies in the group, the question is where you should do it? In case of MVVM in view model? With the classic DI view model completely agnistic to how the use case was initialized and dependency to that use case is set in view model, removing too much knowledge from view model about the actual implementation of dependencies
r
The Reader Monad in general does not make a lot of sense IMO in Kotlin because in Kotlin you have receiver functions and delegates
This allows you to inject dependencies expressed as functions with a receiver
s
You should satisfy dependencies at the edge where you run the program. On Android this is typically
onResume
in the activity. But like @raulraja said receivers is the better tool here.
i
Thx folks!