|
ABSTRACT
Higher-order abstract syntax is a simple technique for implementing languages with functional programming. Object variables and binders are implemented by variables and binders in the host language. By using this technique, one can avoid implementing common and tricky routines dealing with variables, such as capture-avoiding substitution. However, despite the advantages this technique provides, it is not commonly used because it is difficult to write sound elimination forms (such as folds or catamorphisms) for higher-order abstract syntax. To fold over such a datatype, one must either simultaneously define an inverse operation (which may not exist) or show that all functions embedded in the datatype are parametri.In this paper, we show how first-class polymorphism can be used to guarantee the parametricity of functions embedded in higher-order abstract syntax. With this restriction, we implement a library of iteration operators over data-structures containing functionals. From this implementation, we derive "fusion laws" that functional programmers may use to reason about the iteration operator. Finally, we show how this use of parametric polymorphism corresponds to the Schürmann, Despeyroux and Pfenning method of enforcing parametricity through modal types. We do so by using this library to give a sound and complete encoding of their calculus into System F?. This encoding can serve as a starting point for reasoning about higher-order structures in polymorphic languages.
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
|
Umut A. A. Acar , Guy E. Blelloch , Robert Harper, Selective memoization, Proceedings of the 30th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.14-25, January 15-17, 2003, New Orleans, Louisiana, USA
|
| |
2
|
|
| |
3
|
C. Böhm and A. Berarducci. Automatic synthesis of typed ?-programs on term algebras. Theoretical Computer Science, 39:135--154, 1985.
|
| |
4
|
A. Church. A formulation of the simple theory of types. Journal of Symbolic Logic, 5:56--68, 1940.
|
| |
5
|
D. Clarke, R. Hinze, J. Jeuring, A. Löh, and J. de Wit. The Generic Haskell user's guide. Technical Report UU-CS-2001-26, Utrecht University, 2001.
|
| |
6
|
O. Danvy and A. Filinski. Representing control: a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, Dec. 1992.
|
 |
7
|
|
| |
8
|
|
 |
9
|
Leonidas Fegaras , Tim Sheard, Revisiting catamorphisms over datatypes with embedded functions (or, programs from outer space), Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.284-294, January 21-24, 1996, St. Petersburg Beach, Florida, United States
[doi> 10.1145/237721.237792]
|
| |
10
|
J.-Y. Girard. Une extension de l'interprétation de Gödel à l'analyse, et son application à l'élimination de coupures dans l'analyse et la théorie des types. In J. E. Fenstad, editor, Proceedings of the Second Scandinavian Logic Symposium, pages 63--92. North-Holland Publishing Co., 1971.
|
| |
11
|
R. Hinze. Polytypic values possess polykinded types. Science of Computer Programming, 43(2--3):129--159, 2002. MPC Special Issue.
|
| |
12
|
|
| |
13
|
M. P. Jones. A system of constructor classes: overloading and implicit higher-order polymorphism. Journal of Functional Programming, 5(1), Jan. 1995.
|
| |
14
|
|
| |
15
|
Erik Meijer , Maarten Fokkinga , Ross Paterson, Functional programming with bananas, lenses, envelopes and barbed wire, Proceedings of the 5th ACM conference on Functional programming languages and computer architecture, p.124-144, June 1991, Cambridge, Massachusetts, United States
|
 |
16
|
|
| |
17
|
D. Miller. An extension to ML to handle bound variables in data structures: Preliminary report. In Proceedings of the Logical Frameworks BRA Workshop, May 1990.
|
 |
18
|
|
| |
19
|
S. Peyton Jones, editor. Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, 2003.
|
| |
20
|
|
 |
21
|
|
| |
22
|
|
| |
23
|
|
| |
24
|
|
| |
25
|
C. Schürmann, R. Fontana, and Y. Liao. Delphin: Functional programming with deductive systems. Available at http://cs-www.cs.yale.edu/homes/carsten/, 2002.
|
| |
26
|
|
 |
27
|
|
 |
28
|
|
| |
29
|
G. Washburn. Modal typing for specifying run-time code generation. Available from http://www.cis.upenn.edu/~geoffw/research/, 2001.
|
| |
30
|
|
 |
31
|
Hongwei Xi , Chiyan Chen , Gang Chen, Guarded recursive datatype constructors, Proceedings of the 30th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.224-235, January 15-17, 2003, New Orleans, Louisiana, USA
|
|