|
ABSTRACT
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.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
Andrew W. Appel and David B. MacQueen. Standard ML of New Jersey. in Third international Symposium on Programming Language implementation and Logic Programming, number 528 in Lecture Notes in Computer Science, pages 1-13, Passau, Germany, August 1991.
|
 |
2
|
H. Abelson , R. K. Dybvig , C. T. Haynes , G. J. Rozas , N. I. Adams, IV , D. P. Friedman , E. Kohlbecker , G. L. Steele, Jr. , D. H. Bartley , R. Halstead , D. Oxley , G. J. Sussman , G. Brooks , C. Hanson , K. M. Pitman , M. Wand , William Clinger , Jonathan Rees, Revised report on the algorithmic language scheme, ACM SIGPLAN Lisp Pointers, v.IV n.3, p.1-55, July, 1991
[doi> 10.1145/382130.382133]
|
 |
3
|
|
| |
4
|
Olivier Danvy and Andrzej Filinski. Representing control: A study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361- 391, December 1992.
|
 |
5
|
Bruce Duba , Robert Harper , David MacQueen, Typing first-class continuations in ML, Proceedings of the 18th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.163-173, January 21-23, 1991, Orlando, Florida, United States
[doi> 10.1145/99583.99608]
|
 |
6
|
|
| |
7
|
|
 |
8
|
Matthias Felleisen , Mitch Wand , Daniel Friedman , Bruce Duba, Abstract continuations: a mathematical semantics for handling full jumps, Proceedings of the 1988 ACM conference on LISP and functional programming, p.52-62, July 25-27, 1988, Snowbird, Utah, United States
[doi> 10.1145/62678.62684]
|
 |
9
|
|
 |
10
|
|
| |
11
|
|
| |
12
|
Julia L. Lawall and Olivier Danvy. Continuationbased partial evaluation. Indiana University and Aarhus University. Personal communication, October 1993.
|
| |
13
|
|
| |
14
|
|
| |
15
|
Eugenio Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90- 113, Laboratory for Foundations of Computer Science, University of Edinburgh, Edinburgh, Scotland, April 1990.
|
| |
16
|
|
| |
17
|
Chetan R. Murthy. Control operators, hierarchies, and pseudo-classical type systems" A-translation at work. In Proceedings of the A CM SIGPLAN Workshop on Continuations, pages 49-71, San Francisco, California, June 1992. (Technical Report No. STAN-CS-92-1426, Department of Computer Science, Stanford University).
|
 |
18
|
|
| |
19
|
Gordon D. Plotkin. Call-by-name, call-by-value and the ,~-calculus. Theoretical Computer Science, 1(2):125-159, December 1975.
|
 |
20
|
|
 |
21
|
|
| |
22
|
|
 |
23
|
|
 |
24
|
|
 |
25
|
|
| |
26
|
|
 |
27
|
|
| |
28
|
Brian C. Smith. Reflection and Semantics in a Procedural Language. PhD thesis, Massachusetts Institute of Technology, Cambridge, Massachusetts, January 1982. MIT-LCS-TR-272.
|
 |
29
|
|
| |
30
|
Joseph E. Stoy. The congruence of two programming language definitions. Theoretical Computer Science, 13(2):151-174, February 1981.
|
 |
31
|
|
 |
32
|
|
| |
33
|
|
| |
34
|
Mitchell Wand and Daniel P. Friedman. The mystery of the tower revealed: A non-reflective description of the reflective tower. Lisp and Symbolic Computation, 1(1), May 1988.
|
CITED BY 39
|
|
|
|
|
|
|
|
|
|
|
Mads Sig Ager , Dariusz Biernacki , Olivier Danvy , Jan Midtgaard, A functional correspondence between evaluators and abstract machines, Proceedings of the 5th ACM SIGPLAN international conference on Principles and practice of declaritive programming, p.8-19, August 27-29, 2003, Uppsala, Sweden
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Carl A. Gunter , Didier Rémy , Jon G. Riecke, A generalization of exceptions and control in ML-like languages, Proceedings of the seventh international conference on Functional programming languages and computer architecture, p.12-23, June 26-28, 1995, La Jolla, California, United States
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sheng Liang , Paul Hudak , Mark Jones, Monad transformers and modular interpreters, Proceedings of the 22nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.333-343, January 23-25, 1995, San Francisco, California, United States
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
H. Abelson , R. K. Dybvig , C. T. Haynes , G. J. Rozas , N. I. Adams Iv , D. P. Friedman , E. Kohlbecker , G. L. Steele, Jr. , D. H. Bartley , R. Halstead , D. Oxley , G. J. Sussman , G. Brooks , C. Hanson , K. M. Pitman , M. Wand, Revised Report on the Algorithmic Language Scheme, Higher-Order and Symbolic Computation, v.11 n.1, p.7-105, August 1998
|
|
|
|
|
|
|
|
|
|
|
|
N. I. Adams, IV , D. H. Bartley , G. Brooks , R. K. Dybvig , D. P. Friedman , R. Halstead , C. Hanson , C. T. Haynes , E. Kohlbecker , D. Oxley , K. M. Pitman , G. J. Rozas , G. L. Steele, Jr. , G. J. Sussman , M. Wand , H. Abelson, Revised5 report on the algorithmic language scheme, ACM SIGPLAN Notices, v.33 n.9, p.26-76, Sept. 1, 1998
|
|
|
|
|
|
|
|