skip to main content
10.1145/1707790.1707792acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Singleton types here, singleton types there, singleton types everywhere

Authors Info & Claims
Published:19 January 2010Publication History

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. Thierry Coquand and Gérard P. Huet. The calculus of constructions. Information and Computation, 76: 95--120, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Karl Crary and Stephanie Weirich. Flexible type analysis. In International Conference on Functional Programming, pages 233--248, Paris, France, September 1999. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Karl Crary, Stephanie Weirich, and Greg Morrisett. Intensional polymorphism in type-erasure semantics. Journal of Functional Programming, 12 (6): 567--600, November 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Matthias Felleisen. On the expressive power of programming languages. Science of Computer Programming, 17 (1-3): 35--75, December 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. 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 ScholarGoogle Scholar
  10. Ralf Hinze. Polytypic values possess polykinded types. Science of Computer Programming, 43 (2-3): 129--159, May-June 2002.Google ScholarGoogle ScholarCross RefCross Ref
  11. Christopher League and Stefan Monnier. Typed compilation against non-manifest base classes. Lecture Notes in Computer Science, 3956: 77--98, January 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. Stefan Monnier. Typed regions. In Informal proceedings of the SPACE Workshop, Venice, Italy, January 2004.Google ScholarGoogle Scholar
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Singleton types here, singleton types there, singleton types everywhere

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          PLPV '10: Proceedings of the 4th ACM SIGPLAN workshop on Programming languages meets program verification
          January 2010
          70 pages
          ISBN:9781605588902
          DOI:10.1145/1707790

          Copyright © 2010 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 19 January 2010

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate18of25submissions,72%

          Upcoming Conference

          POPL '25

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader