2015 · 88 citations · 20 references
ComputingComputer ScienceAlgebraProgramming LanguagesTheory Of ComputationAbstract Syntax TreesData-flow AnalysisFunctional ProgrammingIntermediate RepresentationType CheckingType SystemsAbstraction MechanismsKan ExtensionsMonadic EffectsMonadic SemanticsMonadsType-level Programming
We present a rational reconstruction of extensible effects, the recently proposed alternative to monad transformers, as the confluence of efforts to make effectful computations compose. Free monads and then extensible effects emerge from the straightforward term representation of an effectful computation, as more and more boilerplate is abstracted away. The generalization process further leads to freer monads, constructed without the Functor constraint. The continuation exposed in freer monads can then be represented as an efficient type-aligned data structure. The end result is the algorithmically efficient extensible effects library, which is not only more comprehensible but also faster than earlier implementations. As an illustration of the new library, we show three surprisingly simple applications: non-determinism with committed choice (LogicT), catching IO exceptions in the presence of other effects, and the semi-automatic management of file handles and other resources through monadic regions. We extensively use and promote the new sort of `laziness', which underlies the left Kan extension: instead of performing an operation, keep its operands and pretend it is done.
20
Monad transformers and modular interpreters
Sheng Liang, Paul Hudak, Mark P. Jones · 1995 · 504 citations · Full text
Olivier Danvy, Andrzej Filinski · 1990 · 403 citations · Full text
Wouter Swierstra · Journal of Functional Programming · 2008 · 282 citations · Full text
Ohad Kammar, Sam Lindley, Nicolas Oury · 2013 · 129 citations
Computing, Computer Science, Algebra +12
Building interpreters by composing monads
Guy L. Steele · 1994 · 105 citations · Full text