435225 (3) [Avatar] Offline
I have a question about implementing Dependency Injection with Kleisli.

For instance take a look at the chapter five example code: https://github.com/debasishg/frdomain/tree/master/src/main/scala/frdomain/ch5

Here we have AccountService that is configurable with Kleisli. AccountService depends on some AccountRepository. But AccountRepository implementation does not need any configuration there and is not configurable because its methods return \/ instead of Kleislis. But what if we need to provide some configuration to the AccountRepository as well? How should we refactor the code to handle it?
Debasish Ghosh (116) [Avatar] Offline
Sorry for the late reply. I need to find some time to code an example for this. Unfortunately I haven't yet been able to find that time. But it's definitely possible. You need to compose the construction of repositories and services within one monadic expression. Then finally when you run the expression you supply the values from the environment. If this helps, it's great, otherwise I will work up an example for you ..

Pls let me know ..

435225 (3) [Avatar] Offline
Thanks for the reply and for the book!

It would be awesome to see some example. Here I've prepared a gist, which I believe should clarify my question a little bit:
Debasish Ghosh (116) [Avatar] Offline
I will take a look next week during the holidays when I have some spare time. Meanwhile I am too much stressed out with work related activities. Thanks for the gist - I will explore how we can make it more functional. Meanwhile you can take a look at https://libraries.io/github/zalando/grafter - it may have something that solves your issue.

435225 (3) [Avatar] Offline
Awesome! Thanks.
I'll definitely look at Grafter. I do not expect anything but brilliant from the creator of Eff ))
312748 (5) [Avatar] Offline
Any chance of seeing examples of cases where a method needs multiple repositories as dependencies?