We make monadic components more reusable and robust to changes
by employing two new techniques for virtualizing the monad stack: the
monad zipper and monad views.
The monad zipper is a higher-order monad transformer that creates virtual
monad stacks by ignoring particular layers in a concrete stack. Monad
views provide a general framework for monad stack virtualization: they take
the monad zipper one step further and integrate it with a wide range of other
virtualizations. For instance, particular views
allow restricted access to monads in the stack.
Furthermore, monad views provide components with a
call-by-reference-like mechanism for accessing particular layers of
the monad stack.
With our two new mechanisms, the monadic effects required by
components no longer need to be literally reflected in the concrete monad
stack. This makes these components more reusable and robust to changes.