When I made this, I was unaware of the FSharpPlus project - which provides not only a Reader monad, but many other types used in common functional programming paradigms. It is actively maintained, whereas this one has not been and likely will not be.
An implementation of the Reader monad in F#
This project arose out of my desire to use this pattern in different projects, but not wanting to copy/paste it over and over. Feel free to use it; PRs are welcome, as I am not a monad expert.
The code here was created based on prior work from several individuals:
- Carsten König and his "Dependency Injection - A Functional Way" post
- Matthew Podwysokci and his "Much Ado about Monads - Reader Edition" post
- Scott Wlaschin and his "Reinventing the Reader Monad" post (and that entire series)
- Chet Husk and his one-on-one feedback to my first attempt to use this
(Sorry, Scott - I'm still not ready to write a monad tutorial...)