ACM Home Page
Please provide us with feedback. Feedback
Foundations for structured programming with GADTs
Full text PdfPdf (221 KB)
Source
Annual Symposium on Principles of Programming Languages archive
Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages table of contents
San Francisco, California, USA
SESSION: Session 9 table of contents
Pages 297-308  
Year of Publication: 2008
ISBN:978-1-59593-689-9
Also published in ...
Authors
Patricia Johann  Rutgers University, Camden, NJ
Neil Ghani  University of Nottingham, Nottingham, United Kingdom
Sponsors
ACM: Association for Computing Machinery
SIGACT: ACM Special Interest Group on Algorithms and Computation Theory
SIGPLAN: ACM Special Interest Group on Programming Languages
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 9,   Downloads (12 Months): 101,   Citation Count: 2
Additional Information:

abstract   references   cited by   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1328438.1328475
What is a DOI?

ABSTRACT

GADTs are at the cutting edge of functional programming and becomemore widely used every day. Nevertheless, the semantic foundations underlying GADTs are not well understood. In this paper we solve this problem by showing that the standard theory of data types as carriers of initial algebras of functors can be extended from algebraic and nested data types to GADTs. We then use this observation to derivean initial algebra semantics for GADTs, thus ensuring that all of the accumulated knowledge about initial algebras can be brought to bear on them. Next, we use our initial algebra semantics for GADTs to derive expressive and principled tools --- analogous to the well-known and widely-used ones for algebraic and nested data types---for reasoning about, programming with, and improving the performance of programs involving, GADTs; we christen such a collection of tools for a GADT an initial algebra package. Along the way, we give a constructive demonstration that every GADT can be reduced to one which uses only the equality GADT and existential quantification. Although other such reductions exist in the literature, ours is entirely local, is independent of any particular syntactic presentation of GADTs, and can be implemented in the host language, rather than existing solely as a metatheoretical artifact. The main technical ideas underlying our approach are (i) to modify the notion of a higher-order functor so that GADTs can be seen as carriers of initial algebras of higher-order functors, and (ii) to use left Kan extensions to trade arbitrary GADTs for simpler-but-equivalent ones for which initial algebra semantics can bederived.


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
 
2
I. Bayley. Generic Operations on Nested Datatypes. Ph.D. Dissertation, Univ. of Oxford, 2001. At http://web.comlab.ox.ac.uk/oucl/research/areas/ap/papers/bayley-thesis.pdf
 
3
P. Blampied. Structured Recursion for Non-uniform Data-types. Ph.D. Dissertation, Univ. of Nottingham, 2000. At http://www.cs.nott.ac.uk/Research/fop/blampied-thesis.pdf
 
4
 
5
 
6
R. Bird and R. Paterson. Generalised folds for nested datatypes. Formal Aspects of Computing 11(2) (1999), pp. 200--222.
 
7
J. Cheney and R. Hinze. First-class phantom types. At http://www.informatik.uni-bonn.de/~ralf/publications/Phantom.pdf
 
8
P. Dybjer. Inductive Families. Formal Aspects of Computing 6(4), pp. 440--465, 1994.
9
10
 
11
N. Ghani, T. Uustalu, and V. Vene. Build, augment and destroy. Universally. Proceedings, Asian Symposium on Programming Languages, pp. 327--347, 2003.
 
12
P. Johann and N. Ghani. Initial algebra semantics is enough! Proceedings, Typed Lambda Calculus and Applications, pp. 207--222, 2007.
 
13
P. Johann and N. Ghani. Programming with Nested Types. Submitted, 2007.
 
14
 
15
MacLane, S. Categories for the Working Mathematician. Springer-Verlag, 1971.
 
16
 
17
C. McBride. Epigram: Practical programming with dependent types. Proceedings, 5th International Summer School on Advanced Functional Programming, 2004. At http://www.e-pig.org/downloads/epigram-notes.pdf
 
18
The Omega Download Page. http://web.cecs.pdx.edu/~sheard/Omega/index.html
 
19
 
20
T. Sheard, J. Hook, and N Linger. GADTs + extensible kinds = dependent programming. At http://www.cs.pdx.edu/~sheard/papers/GADT+ExtKinds.ps
 
21
T. Sheard and E. Pasalic. Meta-programming with built-in type equality. Proceedings, Logical Frameworks and Meta-languages, 2004. At http://homepage.mac.com/pasalic/p2/papers/LFM04.pdf
 
22
M. Sulzmann and M. Wang. A systematic translation of guarded recursive data types to existential types. At http://www.comp.nus.edu.sg/~sulzmann/research/ms.html
 
23
M. Sulzmann and M. Wang. Translating generalized algebraic data types to System F. Manuscript, 2005. At http://www.comp.nus.edu.sg/~sulzmann/manuscript/simple-translate-gadts.ps
24
25
26
27


Collaborative Colleagues:
Patricia Johann: colleagues
Neil Ghani: colleagues