Jonathan Sobel, Erik Hilsdale, R.~Kent Dybvig, and Daniel~P.~Friedman, Abstraction and Performance from Explicit Monadic Reflection. ACM SIGPLAN Workshop on Scheme and Functional Programming. September, 2005. (bibtex).
Most of the existing literature about monadic programming focuses on theory but does not address issues of software engineering. Using monadic parsing as a running example, we demonstrate monadic programs written in a typical style, recognize how they violate abstraction boundaries, and recover clean abstraction crossings through monadic reflection. Once monadic reflection is made explicit, it is possible to construct a grammar for monadic programming that is independent of domain-specific operations. This grammar, in turn, enables the redefinition of the monadic operators as macros that eliminate at expansion time the overhead imposed by functional representations. The results are very efficient monadic programs; for parsing, the output code is competitive with good hand-crafted parsers.