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.
@article{schrijvers:2011:icfp,
author = {Schrijvers, Tom and Oliveira, Bruno C. d. S.},
editor = {Danvy, Olivier},
title = {{Monads, zippers and views : virtualizing the monad stack}},
journal = {ACM SIGPLAN NOTICES},
year = {2011},
ISBN = {9781450308656},
ISSN = {0362-1340},
abstract = {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.
},
}