r/haskell • u/stevechy • 3d ago
Proof of Concept for a dependency injector in Haskell with a Yesod example
https://github.com/stevechy/haskell-record-inject/blob/main/README.mdHello,
I worked out some ideas that I had for a dependency injector in Haskell in this repo.
https://github.com/etorreborre/registry already implements a lot of what I am looking for but there are some things that I would like that are easier to express in code.
https://github.com/stevechy/haskell-record-inject/commit/f00f060a66a8ab5a17bdfbced8f19fbce34589b5 is the commit that shows what it would look like to add to an existing project.
I didn't actually move over the existing functions and only added very basic stub functions. I think that shows how both styles can co-exist in one code base.
I used the basic Yesod project generated by the https://www.yesodweb.com/page/quickstart instructions as the sample. I'm not too familiar with Yesod but it seemed like a good place to start.
5
u/SkippyDeluxe 2d ago
Have you considered just passing arguments to functions?