createC :: A → B → IO C
I find it good practice to log when connecting to a DB
fwiw, it tried to tackle this requirement with the “build a fixpoint” approach. I did not find a direct way. The closest I managed to do (gist) was to return “initializer actions” along with each component, accumulate them, and execute them before application start. But it complicates the component somewhat, and allows components to exist in an unitialized state.
Perhaps libraries like registry
could handle this is a more natural way.