skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Reusable

A specification for dependent types in Haskell

Published:29 August 2017Publication History
Skip Abstract Section

Abstract

We propose a core semantics for Dependent Haskell, an extension of Haskell with full-spectrum dependent types. Our semantics consists of two related languages. The first is a Curry-style dependently-typed language with nontermination, irrelevant arguments, and equality abstraction. The second, inspired by the Glasgow Haskell Compiler's core language FC, is its explicitly-typed analogue, suitable for implementation in GHC. All of our results---chiefly, type safety, along with theorems that relate these two languages---have been formalized using the Coq proof assistant. Because our work is backwards compatible with Haskell, our type safety proof holds in the presence of nonterminating computation. However, unlike other full-spectrum dependently-typed languages, such as Coq, Agda or Idris, because of this nontermination, Haskell's term language does not correspond to a consistent logic.

Skip Supplemental Material Section

Supplemental Material

References

  1. Carlo Angiuli, Robert Harper, and Todd Wilson. 2017. Computational higher-dimensional type theory. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. ACM, 680–693. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. David Aspinall and Martin Hoffman. 2005. Dependent Types. MIT Press, 45–86. http://www.cis.upenn.edu/~bcpierce/attapl/Google ScholarGoogle Scholar
  3. Lennart Augustsson. 1998. Cayenne—a language with dependent types. In Proc. ACM SIGPLAN International Conference on Functional Programming (ICFP ’98). ACM, 239–250. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Brian Aydemir and Stephanie Weirich. 2010. LNgen: Tool Support for Locally Nameless Representations. Technical Report MS-CIS-10-24. Computer and Information Science, University of Pennsylvania.Google ScholarGoogle Scholar
  5. Henk Barendregt. 1991. Introduction to generalized type systems. J. Funct. Program. 1, 2 (1991), 125–154.Google ScholarGoogle ScholarCross RefCross Ref
  6. Bruno Barras and Bruno Bernardo. 2008. The Implicit Calculus of Constructions as a Programming Language with Dependent Types. In Foundations of Software Science and Computational Structures (FOSSACS 2008), Roberto Amadio (Ed.). Springer Berlin Heidelberg, Budapest, Hungary, 365–379. Google ScholarGoogle ScholarCross RefCross Ref
  7. Marc Bezem, Thierry Coquand, and Simon Huber. 2014. A model of type theory in cubical sets. In 19th International Conference on Types for Proofs and Programs (TYPES 2013), Vol. 26. 107–128.Google ScholarGoogle Scholar
  8. A. Bove and V. Capretta. 2005. Modelling General Recursion in Type Theory. Mathematical Structures in Computer Science 15 (February 2005), 671–708. Cambridge University Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Edwin Brady. 2005. Practical Implementation of a Dependently Typed Functional Programming Language. Ph.D. Dissertation. Durham University.Google ScholarGoogle Scholar
  10. Edwin Brady. 2013. Idris, a general-purpose dependently typed programming language: Design and implementation. J. Funct. Prog. 23 (2013).Google ScholarGoogle Scholar
  11. Joachim Breitner, Richard A. Eisenberg, Simon Peyton Jones, and Stephanie Weirich. 2014. Safe Zero-cost Coercions for Haskell. In International Conference on Functional Programming (ICFP ’14). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Luca Cardelli. 1986. A Polymorphic Lambda Calculus with Type:Type. Technical Report 10. Degital Equipment Corporation, SRC.Google ScholarGoogle Scholar
  13. Chris Casinghino, Vilhelm Sjöberg, and Stephanie Weirich. 2014. Combining Proofs and Programs in a Dependently Typed Language. In POPL 2014: 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. San Diego, CA, USA, 33–45. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Manuel M. T. Chakravarty, Gabriele Keller, and Simon Peyton Jones. 2005. Associated Type Synonyms. In International Conference on Functional Programming (ICFP ’05). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. James Cheney and Ralf Hinze. 2003. First-Class Phantom Types. Technical Report. Cornell University.Google ScholarGoogle Scholar
  16. Coq development team. 2004. The Coq proof assistant reference manual. LogiCal Project. http://coq.inria.fr Version 8.0.Google ScholarGoogle Scholar
  17. Thierry Coquand. 1986. A Calculus of Constructions. (Nov. 1986). manuscript.Google ScholarGoogle Scholar
  18. Julien Cretin. 2014. Erasable coercions: a unified approach to type systems. Ph.D. Dissertation. Université Paris Diderot (Paris 7).Google ScholarGoogle Scholar
  19. Julien Cretin and Didier Rémy. 2014. System F with Coercion Constraints. In Logics In Computer Science (LICS). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Haskell B. Curry, J. Roger Hindley, and J.P. Seldin (Eds.). 1972. Combinatory logic: Volume II. Amsterdam: North-Holland Pub. Co.Google ScholarGoogle Scholar
  21. Luis Damas and Robin Milner. 1982. Principal Type-Schemes for Functional Programs. In Conference Record of the 9th Annual ACM Symposium on Principles of Programming Languages. ACM Press, New York, 207–12. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Peter Dybjer and Anton Setzer. 1999. A finite axiomatization of inductive-recursive definitions. In Typed Lambda Calculi and Applications, volume 1581 of Lecture Notes in Computer Science. Springer, 129–146. Google ScholarGoogle ScholarCross RefCross Ref
  23. Richard A. Eisenberg. 2016. Dependent Types in Haskell: Theory and Practice. Ph.D. Dissertation. University of Pennsylvania.Google ScholarGoogle Scholar
  24. Richard A. Eisenberg and Simon Peyton Jones. 2017. Levity Polymorphism. In PLDI ’17. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Richard A. Eisenberg, Stephanie Weirich, and Hamidhasan G. Ahmed. 2016. Visible Type Application. In European Symposium on Programming (ESOP). 229–254. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. H. Geuvers and F. Wiedijk. 2004. A logical framework with explicit conversions. In LFM’04, Proceedings of the Fourth International Workshop on Logical Frameworks and Meta-Languages, Cork, Ireland, Carsten Schuermann (Ed.). 32–45.Google ScholarGoogle Scholar
  27. Jean-Yves Girard. 1971. Une Extension De L’Interpretation De Gödel à L’Analyse, Et Son Application à L’Élimination Des Coupures Dans L’Analyse Et La Theorie Des Types. In Proceedings of the Second Scandinavian Logic Symposium, J.E. Fenstad (Ed.). Studies in Logic and the Foundations of Mathematics, Vol. 63. Elsevier, 63 – 92. http://www.sciencedirect. com/science/article/pii/S0049237X08708437Google ScholarGoogle ScholarCross RefCross Ref
  28. Jean-Yves Girard. 1972. Interprétation fonctionnelle et élimination des coupures de l’arithmétique d’ordre supérieur. Ph.D. Dissertation. Université Paris 7.Google ScholarGoogle Scholar
  29. Georges Gonthier, Assia Mahboubi, and Enrico Tassi. 2016. A Small Scale Reflection Extension for the Coq system. Research Report RR-6455. Inria Saclay Ile de France. https://hal.inria.fr/inria- 00258384Google ScholarGoogle Scholar
  30. Adam Gundry. 2013. Type Inference, Haskell and Dependent Types. Ph.D. Dissertation. University of Strathclyde.Google ScholarGoogle Scholar
  31. Chung-Kil Hur. 2010. Agda with the excluded middle is inconsistent? URL https://lists.chalmers.se/pipermail/agda/2010/ 001522.html .. (2010).Google ScholarGoogle Scholar
  32. Barry Jay and Simon Peyton Jones. 2008. Scrap Your Type Applications. In Proceedings of the 9th International Conference on Mathematics of Program Construction (MPC ’08). Springer-Verlag, Berlin, Heidelberg, 2–27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Garrin Kimmel, Aaron Stump, Harley D. Eades, Peng Fu, Tim Sheard, Stephanie Weirich, Chris Casinghino, Vilhelm Sjöberg, Nathin Collins, and Ki Yunh Anh. 2013. Equational reasoning about programs with general recursion and call-by-value semantics. Progress in Informatics 10 (March 2013), 19–48. http://www.nii.ac.jp/pi/ Google ScholarGoogle ScholarCross RefCross Ref
  34. Per Martin-Löf. 1971. A Theory of Types. (1971). Unpublished manuscript.Google ScholarGoogle Scholar
  35. Per Martin-Löf. 1975. An intuitionistic theory of types: predicative part. In Logic Colloquium ’73, Proceedings of the Logic Colloquium, H.E. Rose and J.C. Shepherdson (Eds.). Studies in Logic and the Foundations of Mathematics, Vol. 80. North-Holland, 73–118. Google ScholarGoogle ScholarCross RefCross Ref
  36. Per Martin-Löf. 1984. Intuitionistic type theory. Studies in Proof Theory, Vol. 1. Bibliopolis. iv+91 pages.Google ScholarGoogle Scholar
  37. Conor McBride. 2000. Elimination with a Motive. In Types for Proofs and Programs, International Workshop, TYPES 2000, Durham, UK, December 8-12, 2000, Selected Papers. 197–216. Google ScholarGoogle ScholarCross RefCross Ref
  38. Conor McBride. 2004. Epigram. (2004). http://www.dur.ac.uk/CARG/epigram .Google ScholarGoogle Scholar
  39. Alexandre Miquel. 2001. The Implicit Calculus of Constructions Extending Pure Type Systems with an Intersection Type Binder and Subtyping. Springer Berlin Heidelberg, Berlin, Heidelberg, 344–359. Google ScholarGoogle ScholarCross RefCross Ref
  40. Alexandre Miquel. 2010. Re: Agda with the excluded middle is inconsistent? URL https://lists.chalmers.se/pipermail/agda/ 2010/001543.html . (2010).Google ScholarGoogle Scholar
  41. Ulf Norell. 2007. Towards a practical programming language based on dependent type theory. Ph.D. Dissertation. Department of Computer Science and Engineering, Chalmers University of Technology, SE-412 96 Göteborg, Sweden.Google ScholarGoogle Scholar
  42. Simon L. Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Mark Shields. 2007. Practical type inference for arbitrary-rank types. Journal of Functional Programming 17, 1 (Jan. 2007), 1–82. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Simon L. Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Geoffrey Washburn. 2006. Simple unification-based type inference for GADTs. In International Conference on Functional Programming (ICFP). Portland, OR, USA, 50–61. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Frank Pfenning. 1992. On the Undecidability of Partial Polymorphic Type Reconstruction. Technical Report. Pittsburgh, PA, USA.Google ScholarGoogle Scholar
  45. F. Pfenning. 2001. Intensionality, extensionality, and proof irrelevance in modal type theory. In Proceedings 16th Annual IEEE Symposium on Logic in Computer Science. 221–230. Google ScholarGoogle ScholarCross RefCross Ref
  46. Benjamin C. Pierce and David N. Turner. 2000. Local Type Inference. ACM Trans. Program. Lang. Syst. 22, 1 (Jan. 2000), 1–44. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. John C. Reynolds. 1974. Towards a theory of type structure. In Programming Symposium, B. Robinet (Ed.). Lecture Notes in Computer Science, Vol. 19. Springer Berlin Heidelberg, 408–425. Google ScholarGoogle ScholarCross RefCross Ref
  48. Tom Schrijvers, Simon Peyton Jones, Manuel Chakravarty, and Martin Sulzmann. 2008. Type checking with open type functions. In ICFP ’08: Proceeding of the 13th ACM SIGPLAN international conference on Functional programming. ACM, New York, NY, USA, 51–62. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Peter Sewell, Francesco Zappa Nardelli, Scott Owens, Gilles Peskine, Thomas Ridge, Susmit Sarkar, and Rok Strniša. 2010. Ott: Effective tool support for the working semanticist. Journal of Functional Programming 20, 1 (Jan. 2010). Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Vilhelm Sjöberg and Stephanie Weirich. 2015. Programming up to Congruence. In POPL 2015: 42nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. Mumbai, India, 369–382. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Matthieu Sozeau. 2008. Un environnement pour la programmation avec types dépendants. Ph.D. Dissertation. Université Paris 11, Orsay, France.Google ScholarGoogle Scholar
  52. Jan Stolarek, Simon Peyon Jones, and Richard A. Eisenberg. 2015. Injective Type Families for Haskell. In Haskell Symposium (Haskell ’15). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Aaron Stump. 2016. The Calculus of Dependent Lambda Eliminations. (Sept. 2016). http://homepage.cs.uiowa.edu/~astump/ papers/cedille- draft.pdf Submitted for publication.Google ScholarGoogle Scholar
  54. Martin Sulzmann, Manuel M. T. Chakravarty, Simon Peyton Jones, and Kevin Donnelly. 2007. System F with type equality coercions. In Types in languages design and implementation (TLDI ’07). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. Floris van Doorn, Herman Geuvers, and Freek Wiedijk. 2013. Explicit Convertibility Proofs in Pure Type Systems. In Proceedings of the Eighth ACM SIGPLAN International Workshop on Logical Frameworks & Meta-languages: Theory & Practice (LFMTP ’13). ACM, New York, NY, USA, 25–36. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Dimitrios Vytiniotis, Simon Peyton Jones, Tom Schrijvers, and Martin Sulzmann. 2011. OutsideIn(X) Modular type inference with local assumptions. Journal of Functional Programming 21 (2011), 333–412. Issue Special Issue 4-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  57. Dimitrios Vytiniotis, Stephanie Weirich, and Simon Peyton Jones. 2008. FPH: First-class polymorphism for Haskell. In ICFP 2008: The 13th ACM SIGPLAN International Conference on Functional Programming. Victoria, BC, Canada, 295–306.Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Stephanie Weirich, Justin Hsu, and Richard A. Eisenberg. 2013. System FC with Explicit Kind Equality. In International Conference on Functional Programming (ICFP ’13). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  59. J.B. Wells. 1999. Typability and type checking in System F are equivalent and undecidable. Annals of Pure and Applied Logic 98, 1 (1999), 111 – 156. Google ScholarGoogle ScholarCross RefCross Ref
  60. A.K. Wright and M. Felleisen. 1994. A Syntactic Approach to Type Soundness. Inf. Comput. 115, 1 (Nov. 1994), 38–94. Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. Yanpeng Yang, Xuan Bi, and Bruno C. d. S. Oliveira. 2016. Unified Syntax with Iso-types. Springer International Publishing, Cham, 251–270. Google ScholarGoogle ScholarCross RefCross Ref
  62. Brent A. Yorgey, Stephanie Weirich, Julien Cretin, Simon Peyton Jones, Dimitrios Vytiniotis, and José Pedro Magalhães. 2012. Giving Haskell a promotion. In Types in Language Design and Implementation (TLDI ’12). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A specification for dependent types in Haskell

        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

        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!