Composing an F# (non-web) app - DI, partial application?
I've recently embarked upon the F# journey, and I'm rewriting an internal .NET core C# app that syncs between different systems on a schedule.
The current C# app makes use of the generic host and `HostedServices` (`Task`s) for scheduled jobs and leans heavily upon dependency injection to instantiate these.
From what I've read, the more functional style is to use partial application and create explicit compositional root(s). But I can't see to find any concrete examples _anywhere_, and the theoretical examples don't seem to hold up to any kind of scale.
Do people forego the generic/web hosts and the IoC container?
If so, does anyone have any concrete examples?
Should I carry on with the setup that's working, at the risk of more run-time errors and abstraction (I've already faced some issues with DI that were not obvious)?
Posted May 28, 2020, 1:26 PM UTC
Two cents from another recent adopter here. Mark Seemann addresses this matter in his series of posts on “From dependency injection to dependency rejection”. https://blog.ploeh.dk/2017/01/27/from-dependency-injection-to-dependency-rejection/
According to him, partial application is not necessarily the answer. YMMV, hope it can be of use.
+1 on that series; it's great.