The ReaderT Design Pattern (2017)

9 points by abhin4v


mrak

ReaderT over IO gets you pretty far! It gets you access to shared, read-only config as well as mutable shared state by having a TVar or some other mutable STM-backed slot in the reader.

But I've mostly moved on to effectful which is based on this exact pattern, but gives you more flexible effects and typing:

The Eff monad it uses is essentially a ReaderT over IO on steroids, allowing us to extend its environment with data types representing effects.