
Tilmann
Hi,
I hope to get some advice on how to structure an application. So I acquire a handle early on that I use all over the app, but I don't want to pass the handle itself around, but wrap the handle with "commands" that a) make a nicer api and/or b) only allow specific usecases of the handle. I tried and failed to use MonadReader in a straightforward way and now I'm wondering what options there are. Looking forward to your feedback,
Below a certain size I'd actually consider just passing the handle around, possibly in a type holding other info that's needed "all over." At some point that becomes unwieldy and then I'd look at things like - monad transformers (like you have below) - tagless final: https://serokell.io/blog/2018/12/07/tagless-final - readerT design pattern: https://www.fpcomplete.com/blog/2017/06/readert-design-pattern I'm not too experienced with them, but I'm guessing free monads/effects would be an alternative too... /M -- Magnus Therning OpenPGP: 0x927912051716CE39 email: magnus@therning.org twitter: magthe http://magnus.therning.org/ I am always doing that which I cannot do, in order that I may learn how to do it. — Pablo Picasso