skip to main content
research-article

System FC with explicit kind equality

Published:25 September 2013Publication History
Skip Abstract Section

Abstract

System FC, the core language of the Glasgow Haskell Compiler, is an explicitly-typed variant of System F with first-class type equality proofs called coercions. This extensible proof system forms the foundation for type system extensions such as type families (type-level functions) and Generalized Algebraic Datatypes (GADTs). Such features, in conjunction with kind polymorphism and datatype promotion, support expressive compile-time reasoning.

However, the core language lacks explicit kind equality proofs. As a result, type-level computation does not have access to kind-level functions or promoted GADTs, the type-level analogues to expression-level features that have been so useful. In this paper, we eliminate such discrepancies by introducing kind equalities to System FC. Our approach is based on dependent type systems with heterogeneous equality and the "Type-in-Type" axiom, yet it preserves the metatheoretic properties of FC. In particular, type checking is simple, decidable and syntax directed. We prove the preservation and progress theorems for the extended language.

References

  1. T. Altenkirch and C. McBride. Generic programming within dependently typed programming. In J. Gibbons and J. Jeuring, editors, Generic Programming, volume 243 of IFIP Conference Proceedings, pages 1--20. Kluwer, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. T. Altenkirch, C. McBride, and W. Swierstra. Observational equality, now! In Proceedings of the 2007 workshop on Programming Languages meets Program Verification, PLPV '07, pages 57--68, New York, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. L. Augustsson. Cayenne--a language with dependent types. In Proceedings of the third ACM SIGPLAN International Conference on Functional Programming, ICFP '98, pages 239--250, New York, 1998. ACM. 10.1145/289423.289451. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. H. P. Barendregt. Handbook of logic in computer science (vol. 2). chapter Lambda calculi with types, pages 117--309. Oxford University Press, New York, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. B. Barras and B. Bernardo. The implicit calculus of constructions as a programming language with dependent types. In Foundations of Software Science and Computational Structures, volume 4962 of Lecture Notes in Computer Science, pages 365--379. Springer, Berlin, Heidelberg, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. L. Cardelli. A polymorphic lambda calculus with type:type. Technical Report 10, Digital Equipment Corporation Systems Research Center, 1986.Google ScholarGoogle Scholar
  7. M. M. T. Chakravarty, G. Keller, and S. Peyon Jones. Associated type synonyms. In Proceedings of the tenth ACM SIGPLAN International Conference on Functional Programming, ICFP '05, pages 241--253, New York, 2005. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. K. Crary, S. Weirich, and G. Morrisett. Intensional polymorphism in type erasure semantics. In Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming, ICFP '98, pages 301--313, Baltimore, MD, USA, 1998. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. R. A. Eisenberg and S. Weirich. Dependently typed programming with singletons. In Proceedings of the 2012 Haskell Symposium, Haskell '12, pages 117--130, New York, 2012. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. H. Geuvers and F. Wiedijk. A logical framework with explicit conversions. In C. Schuermann, editor, LFM'04, Proceedings of the Fourth International Workshop on Logical Frameworks and Meta-Languages, Cork, Ireland, pages 32--45, 2004.Google ScholarGoogle Scholar
  11. J.-Y. Girard. Interprétation fonctionnelle et élimination des coupures de l'arithmétique d'ordre supérieu. PhD thesis, Université de Paris VII, 1972.Google ScholarGoogle Scholar
  12. M. P. Jones. Type classes with functional dependencies. In 9th European Symposium on Programming, ESOP '00, volume 1782 of Lecture Notes in Computer Science, pages 230--244. Springer, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Fu, Sheard, Weirich, Casinghino, Sjöberg, Collins, and Ahn}kimmel:plpvG. Kimmell, A. Stump, H. D. Eades III, P. Fu, T. Sheard, S. Weirich, C. Casinghino, V. Sjöberg, N. Collins, and K. Y. Ahn. Equational reasoning about programs with general recursion and call-by-value semantics. In Sixth ACM SIGPLAN Workshop Programming Languages meets Program Verification (PLPV '12), 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. R. Licata and R. Harper. Canonicity for 2-dimensional type theory. In Proceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '12, pages 337--348, New York, NY, USA, 2012. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Z. Luo. Computation and reasoning: a type theory for computer science. Oxford University Press, Inc., New York, NY, USA, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. P. Magalhaes. The right kind of generic programming. In 8th ACM SIGPLAN Workshop on Generic Programming, WGP 2012, Copenhagen, Denmark, New York, NY, USA, 2012. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. P. Martin-Löf. Intuitionistic Type Theory. Bibliopolis, 1984.Google ScholarGoogle Scholar
  18. C. McBride. Elimination with a motive. In Selected papers from the International Workshop on Types for Proofs and Programs, TYPES '00, pages 197--216, London, UK, UK, 2002. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. C. T. McBride. Agda-curious?: an exploration of programming with dependent types. In P. Thiemann and R. B. Findler, editors, ICFP, pages 1--2. ACM, 2012. ISBN 978-1-4503-1054-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. A. Miquel. The implicit calculus of constructions: extending pure type systems with an intersection type binder and subtyping. In Proceedings of the 5th international conference on Typed lambda calculi and applications, TLCA'01, pages 344--359, Berlin, Heidelberg, 2001. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. U. Norell. Functional generic programming and type theory, 2002. MSc thesis.Google ScholarGoogle Scholar
  22. N. Oury and W. Swierstra. The power of Pi. In Proceedings of the 13th ACM SIGPLAN international conference on Functional programming, ICFP '08, pages 39--50, New York, NY, USA, 2008. ACM. ISBN 978-1-59593-919-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. S. Peyton Jones, D. Vytiniotis, S. Weirich, and G. Washburn. Simple unification-based type inference for GADTs. In Proceedings of the eleventh ACM SIGPLAN International Conference on Functional Programming, ICFP '06, pages 50--61, New York, NY, USA, 2006. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. T. Schrijvers, S. Peyton Jones, M. Sulzmann, and D. Vytiniotis. Complete and decidable type inference for GADTs. In Proceedings of the 14th ACM SIGPLAN international conference on Functional programming, ICFP '09, pages 341--352, New York, NY, USA, 2009. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Fu, Kimmell, Sheard, Stump, and Weirich}sjoeberg:msfp12V. Sjöberg, C. Casinghino, K. Y. Ahn, N. Collins, H. D. Eades III, P. Fu, G. Kimmell, T. Sheard, A. Stump, and S. Weirich. Irrelevance, heterogenous equality, and call-by-value dependent type systems. In Fourth workshop on Mathematically Structured Functional Programming (MSFP '12), 2012.Google ScholarGoogle Scholar
  26. A. Stump, M. Deters, A. Petcher, T. Schiller, and T. Simpson. Verified programming in Guru. In Proceedings of the 3rd workshop on Programming languages meets program verification, PLPV '09, pages 49--58, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. M. Sulzmann, M. M. T. Chakravarty, S. P. Jones, and K. Donnelly. System F with type equality coercions. In Proceedings of the 2007 ACM SIGPLAN international workshop on Types in languages design and implementation, TLDI '07, pages 53--66, New York, NY, USA, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. F. van Doorn, H. Geuvers, and F. Wiedijk. Explicit convertibility proofs in pure type systems. Draft paper, in submission, http://www.cs.ru.nl/ herman/PUBS/ExplicitPTS.pdf, 2013.Google ScholarGoogle Scholar
  29. D. Vytiniotis, S. Peyton Jones, and J. P. Magalhaes. Equality proofs and deferred type errors: A compiler pearl. In Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, ICFP 2012, Copenhagen, Denmark, New York, NY, USA, 2012. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. S. Weirich, D. Vytiniotis, S. Peyton Jones, and S. Zdancewic. Generative type abstraction and type-level computation (extended version). Technical report, University of Pennsylvania, Nov. 2010.Google ScholarGoogle Scholar
  31. S. Weirich, D. Vytiniotis, S. Peyton Jones, and S. Zdancewic. Generative type abstraction and type-level computation. In Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '11, pages 227--240, New York, NY, USA, 2011. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Z. Yang. Encoding types in ML-like languages. In Proceedings of the Third International Conference on Functional Programming (ICFP), pages 289--300, Baltimore, Maryland, USA, 1998. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. B. A. Yorgey, S. Weirich, J. Cretin, S. Peyton Jones, D. Vytiniotis, and J. P. Magalhaes. Giving Haskell a promotion. In Proceedings of the 8th ACM SIGPLAN workshop on Types in Language Design and Implementation, TLDI '12, pages 53--66, New York, NY, USA, 2012. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. System FC with explicit kind equality

    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

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 48, Issue 9
      ICFP '13
      September 2013
      457 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2544174
      Issue’s Table of Contents
      • cover image ACM Conferences
        ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
        September 2013
        484 pages
        ISBN:9781450323260
        DOI:10.1145/2500365

      Copyright © 2013 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 25 September 2013

      Check for updates

      Qualifiers

      • research-article

    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!