ComputingComputer ScienceProgramming LanguagesSemanticsSyntaxAbstract Syntax TreesCompositional SemanticsFunctional ProgrammingIntermediate RepresentationModel TheoryType SystemsContinuation SemanticsContinuation-passing StyleMonadic EffectsMonadic SemanticsMonads
The paper extends Meyer and Wand's characterization of continuation‑passing versus direct style to a comparison between continuation‑passing and general monadic style. The authors implement the construction in Standard ML with New Jersey extensions and illustrate it with several examples. They show that monads with purely functional unit and extension can be embedded in a call‑by‑value language with composable continuations, that this construct can be represented using ordinary first‑class continuations and a single state, and that with storage and escape effects any such monadic structure can be added as a purely definitional extension without reinterpreting the language.
We show that any monad whose unit and extension operations are expressible as purely functional terms can be embedded in a call-by-value language with “composable continuations”. As part of the development, we extend Meyer and Wand's characterization of the relationship between continuation-passing and direct style to one for continuation-passing vs. general “monadic” style. We further show that the composable-continuations construct can itself be represented using ordinary, non-composable first-class continuations and a single piece of state. Thus, in the presence of two specific computational effects - storage and escapes - any expressible monadic structure (e.g., nondeterminism as represented by the list monad) can be added as a purely definitional extension, without requiring a reinterpretation of the whole language. The paper includes an implementation of the construction (in Standard ML with some New Jersey extensions) and several examples.
27
Notions of computation and monads
Eugenio Moggi · Information and Computation · 1991 · 1.7K citations
Imperative functional programming
Simon Jones, Philip Wadler · 1993 · 1.2K citations · Full text
Call-by-name, call-by-value and the λ-calculus
Gordon Plotkin · Theoretical Computer Science · 1975 · 1.2K citations
Computational lambda-calculus and monads
Eugenio Moggi · 2003 · 858 citations
Computing, Computer Science, Algebra +13
The essence of functional programming
Philip Wadler · 1992 · 676 citations · Full text