reader package:relude

Retrieves a function of the current environment.
The parameterizable reader monad. Computations are functions of a shared environment. The return function ignores the environment, while m >>= k passes the inherited environment to both subcomputations:
The reader monad transformer, which adds a read-only environment to the given monad. The return function ignores the environment, while m >>= k passes the inherited environment to both subcomputations:
See examples in Control.Monad.Reader. Note, the partially applied function type (->) r is a simple reader monad. See the instance declaration below.
Runs a Reader and extracts the final value from it. (The inverse of reader.)
Execute a computation in a modified environment (a specialization of withReaderT).
Execute a computation in a modified environment (a more general version of local).
This function helps with optimizing performance when working with the ReaderT transformer. If you have code like below, that is called in a loop
step :: Instruction -> ReaderT Config IO Result
step instruction = case instruction of
Add -> do stuff ...
Del -> do stuff ...
you can improve performance of your Haskell applications by using etaReaderT in the following way:
step :: Instruction -> ReaderT Config IO Result
step instruction = etaReaderT $ case instruction of
Add -> do stuff ...
Del -> do stuff ...
For a detailed explanation, refer to the following blog post:
Shorter and more readable alias for flip runReader.
>>> usingReader 42 $ asks (+5)
47
Shorter and more readable alias for flip runReaderT.
>>> usingReaderT 42 $ asks (+5)
47