ABSTRACT
Singleton types are often considered a poor man's substitute for dependent types. But their generalization in the form of GADTs has found quite a following. The main advantage of singleton types and GADTs is to preserve the so-called phase distinction, which seems to be so important to make use of the usual compilation techniques.
Of course, they considerably restrict the programmers, which often leads them to duplicate code at both the term and type levels, so as to reflect at the type level what happens at the term level, in order to be able to reason about it.
In this article, we show how to automate such a duplication while eliminating the problematic dependencies. More specifically, we show how to compile the Calculus of Constructions into λH, a non-dependently-typed language, while still preserving all the typing information. Since λH has been shown to be amenable to type preserving CPS and closure conversion, it shows a way to preserve types when doing code extraction and more generally when using all the common compiler techniques.
- Henk P. Barendregt. Lambda calculi with types. In S. Abramsky, D. Gabbay, and T. Maibaum, editors, Handbook of Logic in Computer Science (volume 2). Oxford Univ. Press, 1991.Google ScholarDigital Library
- G. Barthe, J. Hatcliff, and M.H. Sørensen. CPS-translations and applications: the cube and beyond. Higher-Order and Symbolic Computation, 12 (2): 125--170, September 1999. Google ScholarDigital Library
- Thierry Coquand and Gérard P. Huet. The calculus of constructions. Information and Computation, 76: 95--120, 1988. Google ScholarDigital Library
- Karl Crary and Stephanie Weirich. Flexible type analysis. In International Conference on Functional Programming, pages 233--248, Paris, France, September 1999. ACM Press. Google ScholarDigital Library
- Karl Crary, Stephanie Weirich, and Greg Morrisett. Intensional polymorphism in type-erasure semantics. Journal of Functional Programming, 12 (6): 567--600, November 2002. Google ScholarDigital Library
- Matthias Felleisen. On the expressive power of programming languages. Science of Computer Programming, 17 (1-3): 35--75, December 1991. Google ScholarDigital Library
- Kathleen Fisher, John Reppy, and Jon G. Riecke. A calculus for compiling and linking classes. In European Symposium on Programming, volume 1782 of phLNCS, pages 134--149, New York, NY, March/April 2000. Springer-Verlag. Google ScholarDigital Library
- Seth Fogarty, Emir Pašalić, Jeremy Siek, and Walid Taha. Concoqtion: Indexed types now! In Workshop on Partial Evaluation and Semantics-Based Program Manipulation, 2007. Google ScholarDigital Library
- J.Y. Girard. Interprétation Fonctionnelle et Élimination des Coupures dans l'Arithmétique d'Ordre Supérieur. PhD thesis, University of Paris VII, 1972.Google Scholar
- Ralf Hinze. Polytypic values possess polykinded types. Science of Computer Programming, 43 (2-3): 129--159, May-June 2002.Google ScholarCross Ref
- Christopher League and Stefan Monnier. Typed compilation against non-manifest base classes. Lecture Notes in Computer Science, 3956: 77--98, January 2006. Google ScholarDigital Library
- Pierre Letouzey. Extraction in coq: An overview. In 4th conference on Computability in Europe: Logic and Theory of Algorithms, pages 359--369, Berlin, Heidelberg, 2008. Springer-Verlag. ISBN 978-3-540-69405-2. Google ScholarDigital Library
- Yasuhiko Minimide, Greg Morrisett, and Robert Harper. Typed closure conversion. In Symposium on Principles of Programming Languages, pages 271--283. ACM Press, January 1996. Google ScholarDigital Library
- Nathan Mishra-Linger and Tim Sheard. Erasure and polymorphism in pure type systems. In Conference on Foundations of Software Science and Computation Structures, volume 4962 of Lecture Notes in Computer Science, pages 350--364, Budapest, Hungary, April 2008. Google ScholarDigital Library
- Stefan Monnier. Typed regions. In Informal proceedings of the SPACE Workshop, Venice, Italy, January 2004.Google Scholar
- Greg Morrisett, David Walker, Karl Crary, and Neal Glew. From system F to typed assembly language. In Symposium on Principles of Programming Languages, pages 85--97, January 1998. Google ScholarDigital Library
- Frank Pfenning and Conal Elliott. Higher-order abstract syntax. In Symposium on Programming Languages Design and Implementation, pages 199--208, Atlanta, Georgia, June 1988. ACM Press. Google ScholarDigital Library
- John C. Reynolds. Towards a theory of type structure. In Proceedings, Colloque sur la Programmation, Lecture Notes in Computer Science, volume 19, pages 408--425. Springer-Verlag, Berlin, 1974. Google ScholarDigital Library
- Zhong Shao, Bratin Saha, Valery Trifonov, and Nikolaos Papaspyrou. A type system for certified binaries. In Symposium on Principles of Programming Languages, pages 217--232, January 2002. Google ScholarDigital Library
- Valery Trifonov, Bratin Saha, and Zhong Shao. Fully reflexive intensional type analysis. In International Conference on Functional Programming, pages 82--93, Montréal, Canada, September 2000. ACM Press. Google ScholarDigital Library
Index Terms
- Singleton types here, singleton types there, singleton types everywhere
Recommendations
Extensional equivalence and singleton types
We study the λΠΣS≤ calculus, which contains singleton types S(M) classifying terms of base type provably equivalent to the term M. The system includes dependent types for pairs and functions (Σ and Π) and a subtyping relation induced by regarding ...
Singleton types here, singleton types there, singleton types everywhere: (abstract only)
Singleton types are often considered a poor man's substitute for dependent types. But their generalization in the form of GADTs has found quite a following. The main advantage of singleton types and GADTs is to preserve the so-called phase distinction, ...
Comments