- Why does the type of monad transformer reflect the type of the stack "upside-down"?
It is impossible to define a monad composition in general, only in a way specific to the internal effect of the stack. Because of this, the name of the effect is fixed in the name of the transformer and the outer effect becomes a type parameter.
- Why is it possible to reuse existing monads for the top layer of the stack?
The return type of the Kleisli arrow fits well with the type of the stack. For this reason, it is possible to produce the result of the proper type by utilizing the flatMap method of the outer monad.
- Why is it impossible to reuse existing monads for the bottom layer of the stack?
The argument type of the arrow expects a plain argument. Consequently, we need to extract the effect-free value from the context of internal effect. This is only possible in a...