skip to main content
10.1145/1159803.1159811acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Simple unification-based type inference for GADTs

Published:16 September 2006Publication History

ABSTRACT

Generalized algebraic data types (GADTs), sometimes known as "guarded recursive data types" or "first-class phantom types", are a simple but powerful generalization of the data types of Haskell and ML. Recent works have given compelling examples of the utility of GADTs, although type inference is known to be difficult. Our contribution is to show how to exploit programmer-supplied type annotations to make the type inference task almost embarrassingly easy. Our main technical innovation is wobbly types, which express in a declarative way the uncertainty caused by the incremental nature of typical type-inference algorithms.

References

  1. Lennart Augustsson. Cayenne- a language with dependent types. In ACMSIGPLAN International Conference on Functional Programming (ICFP'98), volume 34(1) of ACM SIGPLAN Notices, pages 239--250, Baltimore, 1998. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Lennart Augustsson and Kent Petersson. Silly type families. Available as http://www.cs.pdx.edu/~sheard/papers/silly. pdf, 1994.Google ScholarGoogle Scholar
  3. Arthur L Baars and S. Doaitse Swierstra. Typing dynamic typing. In ACMSIGPLAN International Conference on Functional Programming (ICFP'02), pages 157--166, Pittsburgh, September 2002. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Luca Cardelli. Basic polymorphic typechecking. Polymorphism, 2(1), January 1985.Google ScholarGoogle Scholar
  5. James Cheney and Ralf Hinze. First-class phantom types. CUCIS TR2003-1901, Cornell University, 2003.Google ScholarGoogle Scholar
  6. Thierry Coquand. Pattern matching with dependent types. In Proceedings of the Workshop on Types for Proofs and Program, pages 66--79, Baastad, Sweden, June 1992.Google ScholarGoogle Scholar
  7. Peter Dybjer. Inductive Sets and Families in Martin-Lf's Type Theory. In Grard Huet and Gordon Plotkin, editors, Logical Frameworks. Cambridge University Press, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ralf Hinze. Fun with phantom types. In Jeremey Gibbons and Oege de Moor, editors, The fun of programming, pages 245--262. Palgrave, 2003.Google ScholarGoogle Scholar
  9. Barry Jay. The pattern calculus. ACM Transactions on Programming Languages and Systems, 26:911--937, November 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Lena Magnusson. The implementation of ALF - a proof editor based on Martin-Löf's monomorhic type theory with explicit substitution. PhD thesis, Chalmers University, 1994.Google ScholarGoogle Scholar
  11. Conor McBride and James McKinna. The view from the left. Journal of Functional Programming, 14(1):69--111, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Erik Meijer and Koen Claessen. The design and implementation of Mondrian. In John Launchbury, editor, Haskell workshop, Amsterdam, Netherlands, 1997.Google ScholarGoogle Scholar
  13. Simon Peyton Jones. The Implementation of Functional Programming Languages. Prentice Hall, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Simon Peyton Jones, Geoffrey Washburn, and Stephanie Weirich. Wobbly types: type inference for generalised algebraic data types. Microsoft Research, 2004.Google ScholarGoogle Scholar
  15. François Pottier and Yann Régis-Gianas. Stratified type inference for generalized algebraic data types. In ACM Symposium on Principles of Programming Languages (POPL'06), Charleston, January 2006. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Tim Sheard. Languages of the future. In ACM Conference on Object Orientated Programming Systems, Languages and Applicatioons (OOPSLA'04), 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Tim Sheard. Putting Curry-Howard to work. In Proceedings of ACM Workshop on Haskell, Tallinn, pages 74--85, Tallinn, Estonia, September 2005. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Tim Sheard and Emir Pasalic. Meta-programming with built-in type equality. In Proceedings of the Fourth International Workshop on Logical Frameworks and Meta-languaegs (LFM'04), Cork, July 2004.Google ScholarGoogle Scholar
  19. Peter Stuckey and Martin Sulzmann. Type inference for guarded recursive data types. Technical report, National University of Singapore, 2005.Google ScholarGoogle Scholar
  20. Martin Sulzmann. A Haskell programmer's guide to Chameleon. Available at http://www.comp.nus.edu.sg/sulzmann/chameleon/download/haskell. html, 2003.Google ScholarGoogle Scholar
  21. Martin Sulzmann, JeremyWazny, and Peter Stuckey. A framework for extended algebraic data types. Technical report, National University of Singapore, 2005.Google ScholarGoogle Scholar
  22. Dimitrios Vytiniotis, Stephanie Weirich, and Simon Peyton Jones. Boxy type: Inference for higher-rank types and impredicativity. In ACMSIGPLAN International Conference on Functional Programming (ICFP'06), Portland, Oregon, 2006. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Dimitrios Vytiniotis, Stephanie Weirich, and Simon Peyton Jones. Simple unification-based type inference for GADTs, Technical Appendix. Technical Report MS-CIS-05-22, University of Pennsylvania, April 2006.Google ScholarGoogle Scholar
  24. Hongwei Xi. Applied type system. In Proceedings of TYPES 2003, volume 3085 of Lecture Notes in Computer Science, pages 394--408. Springer Verlag, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  25. Hongwei Xi, Chiyan Chen, and Gang Chen. Guarded recursive datatype constructors. In Proceedings of the 30th ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, pages 224--235. ACM Press, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Hongwei Xi and Frank Pfenning. Dependent types in practical programming. In 26th ACM Symposium on Principles of Programming Languages (POPL'99), pages 214--227, San Antonio, January 1999. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Christoph Zenger. Indexed types. Theoretical Computer Science, pages 147--165, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Simple unification-based type inference for GADTs

      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
        ICFP '06: Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming
        September 2006
        308 pages
        ISBN:1595933093
        DOI:10.1145/1159803
        • General Chair:
        • John Reppy,
        • Program Chair:
        • Julia Lawall
        • cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 41, Issue 9
          Proceedings of the 2006 ICFP conference
          September 2006
          296 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/1160074
          Issue’s Table of Contents

        Copyright © 2006 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 16 September 2006

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • Article

        Acceptance Rates

        Overall Acceptance Rate333of1,064submissions,31%

        Upcoming Conference

        ICFP '23

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!