1. 14
  1.  

  2. 3

    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.

    1. 2

      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.

    2. 1

      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?

      1. 1

        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.