Abstraction and Performance from Explicit Monadic Reflection
نویسندگان
چکیده
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.
منابع مشابه
Abstraction and Performance from Explicit Monadic Re ection
ion and Performance from Explicit Monadic Re ection Jonathan Sobel Erik Hilsdale R. Kent Dybvig Daniel P. Friedman Department of Computer Science
متن کاملOn the Expressive Power of User-Defined Effects
We compare the expressive power of three programming abstractions for user-defined computational effects: Plotkin and Pretnar’s effect handlers, Filinski’s monadic reflection, and delimited control without answertype-modification. This comparison allows a precise discussion about the relative expressiveness of each programming abstraction. It also demonstrates the sensitivity of the relative ex...
متن کاملHow to CPS Transform a Monad
CPS transformation is an important tool in the compilation of functional programming languages. For strict languages, such as our web programming language “Rinso” or Microsoft’s F#, monadic expressions can help with structuring and composing computations. To apply a CPS transformation in the compilation process of such a language, we integrate explicit monadic abstraction in a call-by-value sou...
متن کاملAn Implementation of Modular Monadic Semantics using Folds and Monadic Folds*
Modular monadic semantics can be implemented using folds or catamorphisms over a functor that expresses the abstract syntax of the language. By composing several functors, it is possible to obtain modular interpreters from reusable components. Monadic folds structure programs that process recursively their input and control the side effects of the output they produce. We consider that the seman...
متن کاملProceedings of the Sixth Workshop on Scheme and Functional Programming September 24 , 2005 Tallinn , Estonia
ion and Performance from Explicit Monadic Reflection Jonathan Sobel, Erik Hilsdale, R. Kent Dybvig, Daniel P. Friedman . 27 An Operational Semantics for R5RS Scheme Jacob Matthews and Robert Bruce Findler . . . . . . . . . . . . . . . 41 Commander S The shell as a browser Martin Gasbichler and Eric Knauel . . . . . . . . . . . . . . . . . . . 55 Ubiquitous Mails Erick Gallesio and Manuel Serran...
متن کامل