The State monad represents an external (to the definition of the logic) state, which needs to be taken into account and possibly modified. The Reader monad is similar in the taking into account part—it accepts an external context and passes it over unchanged to every computation down the queue. In terms of the global state we discussed during the examination of the state monad, the Reader will have access to read-only system properties. Because of this, the reader monad is often known as a mechanism for dependency injection—because it takes some outside configuration (not necessarily basic things like strings or numbers, but also possibly other complex components, database access mechanisms, network sockets, or other resources) and makes it available for the function it wraps.
Let's see how Reader is defined. We have already compared State and Reader...