Basically, a Reader is just a wrapper for a function type.
It is quite handy in that it solves the problem to manually having to
thread a single configuration parameter to many functions.
It is often viewed as a way to do dependency injection in FP.
Construct a Reader that will produce the value provided, no matter the environment.
Locally modify the environment for the next Reader action.
Apply a function to the resulting value of the Reader.
Apply a function wrapped in a Reader to a value wrapped in a Reader. This is particularly useful for transforming a succession of resulting values with a single function.
map (\x y z -> ( x, y, z )) (reader 'x')
|> andMap (reader 42)
|> andMap (reader "fourty two")
== reader ('x', 42, "fourty two")Chain a Reader with a computation producing a Reader
Reader env valuerepresents a computation waiting for an environment value to produce its result.