|
ABSTRACT
We implement statically-typed multi-holed contexts in OCaml using an underlying algebraic datatype augmented with phantom types. Existing approaches require dynamic checks or more complex type systems. In order to support concatenation we use two type parameters to represent the number of holes in a context as the difference between two Peano numbers. In order to support plugging a context with contexts of different arity we introduce a datatype of lists of contexts of length n with a total of m holes. Further, we extend our representation to allow holes to be marked with additional type information. As an example, we use these marks to implement statically-typed multi-holed XHTML contexts. We take advantage of Garrigue's relaxed value restriction.
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
|
Thorsten Altenkirch, Conor McBride, and James McKinna. Why dependent types matter. Unpublished manuscript, April 2005. http://www.cs.nott.ac.uk/~txa/publ/ydtm.pdf.
|
 |
2
|
|
| |
3
|
James Cheney and Ralf Hinze. First-class phantom types. Technical Report TR2003-1901, Cornell University, July 2003. http://ecommons.library.cornell.edu/handle/1813/5614.
|
| |
4
|
Ezra Cooper, Sam Lindley, Philip Wadler, and Jeremy Yallop. An idiom's guide to formlets. Technical Report EDI-INF-RR-1263, School of Informatics, University of Edinburgh, 2008a.
|
| |
5
|
Ezra Cooper, Sam Lindley, Philip Wadler, and Jeremy Yallop. The essence of form abstraction, 2008b. http://groups.inf.ed.ac.uk/links/formlets.
|
 |
6
|
|
| |
7
|
|
| |
8
|
Martin Elsman and Ken Friis Larsen. Typing XHTML web applications in ML. In PADL, pages 224--238, 2004.
|
 |
9
|
|
| |
10
|
|
| |
11
|
Jacques Garrigue. Relaxing the value restriction. In FLOPS, pages 196--213, 2004.
|
| |
12
|
|
 |
13
|
|
| |
14
|
|
| |
15
|
|
 |
16
|
Simon Peyton Jones , Dimitrios Vytiniotis , Stephanie Weirich , Geoffrey Washburn, Simple unification-based type inference for GADTs, Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming, September 16-21, 2006, Portland, Oregon, USA
|
| |
17
|
Conor McBride. The derivative of a regular type is its type of one--hole contexts. Unpublished manuscript, 2001. http://strictlypositive.org/diff.pdf.
|
| |
18
|
|
| |
19
|
Anders Møller and Michael I. Schwartzbach. The design space of type checkers for XML transformation languages. In ICDT '05, January 2005.
|
 |
20
|
|
 |
21
|
|
| |
22
|
|
| |
23
|
|
| |
24
|
|
| |
25
|
|
 |
26
|
|
 |
27
|
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
|
 |
28
|
|
| |
29
|
|
| |
30
|
|
|