you can do this with state as well: I think the local-scope function for state is withState but I can’t quite remember. Reader is great because then you know for absolute sure that you won’t have any scoping headaches.
That is true and I should have pointed it out. Another nice quality of doing this with Reader is that you don’t have the ability to mutate the state for a given scoping.
I’m always curious what people see in reader… Why not just pass Context as the first argument and do it that way? What does the monad wrapper get you?
not having to pass Context as the argument in the rhs is nice enough, I think. Adding exceptions or any other monad effect is also a breeze with monad transformers.