skip to main content
research-article
Open Access

A quick look at impredicativity

Published:03 August 2020Publication History
Skip Abstract Section

Abstract

Type inference for parametric polymorphism is wildly successful, but has always suffered from an embarrassing flaw: polymorphic types are themselves not first class. We present Quick Look, a practical, implemented, and deployable design for impredicative type inference. To demonstrate our claims, we have modified GHC, a production-quality Haskell compiler, to support impredicativity. The changes required are modest, localised, and are fully compatible with GHC's myriad other type system extensions.

Skip Supplemental Material Section

Supplemental Material

Presentation at ICFP '20

References

  1. Lennart Augustsson. 2011. Impredicative polymorphism: a use case. http://augustss.blogspot.com/ 2011 /07/impredicativepolymorphism-use-case-in.html.Google ScholarGoogle Scholar
  2. Didier Le Botlan and Didier Rémy. 2003. MLF: raising ML to the power of system F. In Proceedings of the Eighth ACM SIGPLAN International Conference on Functional Programming, ICFP 2003, Uppsala, Sweden, August 25-29, 2003, Colin Runciman and Olin Shivers (Eds.). ACM, 27-38. https://doi.org/10.1145/944705.944709 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Didier Le Botlan and Didier Rémy. 2009. Recasting MLF. Inf. Comput. 207, 6 ( 2009 ), 726-785.Google ScholarGoogle Scholar
  4. Joshua Dunfield and Neelakantan R. Krishnaswami. 2013. Complete and easy bidirectional typechecking for higherrank polymorphism. In ACM SIGPLAN International Conference on Functional Programming, ICFP'13, Boston, MA, USA-September 25-27, 2013, Greg Morrisett and Tarmo Uustalu (Eds.). ACM, 429-442. https://doi.org/10.1145/2500365.2500582 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Joshua Dunfield and Neelakantan R. Krishnaswami. 2019. Sound and Complete Bidirectional Typechecking for Higher-rank Polymorphism with Existentials and Indexed Types. Proc. ACM Program. Lang. 3, POPL, Article 9 ( Jan. 2019 ), 28 pages. https://doi.org/10.1145/3290322 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Richard A. Eisenberg, Joachim Breitner, and Simon Peyton Jones. 2018. Type variables in patterns. In Proceedings of the 11th ACM SIGPLAN International Symposium on Haskell, [email protected] 2018, St. Louis, MO, USA, September 27-17, 2018. 94-105. https://doi.org/10.1145/3242744.3242753 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Richard A. Eisenberg, Stephanie Weirich, and Hamidhasan G. Ahmed. 2016. Visible Type Application. In Proceedings of the 25th European Symposium on Programming Languages and Systems-Volume 9632. Springer-Verlag New York, Inc., New York, NY, USA, 229-254. https://doi.org/10.1007/978-3-662-49498-1_10 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Frank Emrich, Sam Lindley, Jan Stolarek, and James Cheney. 2019. FreezeML: Complete and Easy Type Inference for First-Class Polymorphism. Presented at TyDe 2019.Google ScholarGoogle Scholar
  9. Jacques Garrigue and Didier Rémy. 1999. Semi-Explicit Higher-Order Polymorphism for ML. Information and Computation 155, 1 /2 ( 1999 ), 134-169. http://www.springerlink.com/content/m303472288241339/ A preliminary version appeared in TACS' 97.Google ScholarGoogle Scholar
  10. Daan Leijen. 2008. HMF: simple type inference for first-class polymorphism. In Proceeding of the 13th ACM SIGPLAN international conference on Functional programming, ICFP 2008, Victoria, BC, Canada, September 20-28, 2008. 283-294. https://doi.org/10.1145/1411204.1411245 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Daan Leijen. 2009. Flexible types: robust type inference for first-class polymorphism. In Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, Savannah, GA, USA, January 21-23, 2009. 66-77. https://doi.org/10.1145/1480881.1480891 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Daan Leijen and Andres Löh. 2005. Qualified types for MLF. In Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming, ICFP 2005, Tallinn, Estonia, September 26-28, 2005, Olivier Danvy and Benjamin C. Pierce (Eds.). ACM, 144-155. https://doi.org/10.1145/1086365.1086385 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Dale Miller. 1992. Unification under a Mixed Prefix. J. Symb. Comput. 14, 4 (Oct. 1992 ), 321-358. https://doi.org/10.1016/ 0747-7171 ( 92 ) 90011-R Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Robin Milner. 1978. A Theory of Type Polymorphism in Programming. J. Comput. Syst. Sci. 17, 3 ( 1978 ), 348-375. https://doi.org/10.1016/ 0022-0000 ( 78 ) 90014-4 Google ScholarGoogle ScholarCross RefCross Ref
  15. John C. Mitchell. 1988. Polymorphic Type Inference and Containment. Inf. Comput. 76, 2-3 ( Feb. 1988 ), 211-249. https: //doi.org/10.1016/ 0890-5401 ( 88 ) 90009-0 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Martin Odersky and Konstantin Läufer. 1996. Putting type annotations to work. In Principles of Programming Languages, POPL. 54-67.Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. W. O'Toole and D. K. Giford. 1989. Type Reconstruction with First-Class Polymorphic Values. In Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation (Portland, Oregon, USA) ( PLDI '89). Association for Computing Machinery, New York, NY, USA, 207-217. https://doi.org/10.1145/73141.74836 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Simon Peyton Jones. 2019. GHC Proposal: “Simplify subsumption”. https://github.com/ghc-proposals/ghc-proposals/pull/ 287Google ScholarGoogle Scholar
  19. 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 ( 2007 ), 1-82.Google ScholarGoogle Scholar
  20. Frank Pfenning. 1995. On the Undecidability of Partial Polymorphic Type Reconstruction. Fundamenta Informaticae 19 ( 1995 ). Issue 1/2.Google ScholarGoogle Scholar
  21. Benjamin C. Pierce and David N. Turner. 2000. Local type inference. ACM Trans. Program. Lang. Syst. 22, 1 ( 2000 ), 1-44. https://doi.org/10.1145/345099.345100 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. François Pottier and Yann Régis-Gianas. 2006. Stratified Type Inference for Generalized Algebraic Data Types. In Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Charleston, South Carolina, USA) ( POPL '06). ACM, New York, NY, USA, 232-244. https://doi.org/10.1145/1111037.1111058 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. François Pottier and Didier Rémy. 2005. The Essence of ML Type Inference. In Advanced Topics in Types and Programming Languages, Benjamin C. Pierce (Ed.). MIT Press, Chapter 10, 389-489. http://cristal.inria.fr/attapl/Google ScholarGoogle Scholar
  24. Didier Rémy. 2005. Simple, Partial Type-inference for System F Based on Type-containment. In Proceedings of the Tenth ACM SIGPLAN International Conference on Functional Programming (Tallinn, Estonia) ( ICFP '05). ACM, New York, NY, USA, 130-143. https://doi.org/10.1145/1086365.1086383 Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Claudio V. Russo and Dimitrios Vytiniotis. 2009. QML: Explicit First-class Polymorphism for ML. In Proceedings of the 2009 ACM SIGPLAN Workshop on ML (Edinburgh, Scotland) (ML '09). ACM, New York, NY, USA, 3-14. https: //doi.org/10.1145/1596627.1596630 Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Alejandro Serrano, Jurriaan Hage, Dimitrios Vytiniotis, and Simon Peyton Jones. 2018. Guarded impredicative polymorphism. In Proc ACM SIGPLAN Conference on Programming Languages Design and Implementation. ACM. https://www.microsoft. com/en-us/research/publication/guarded-impredicative-polymorphism/Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Dimitrios Vytiniotis, Simon L. Peyton Jones, Tom Schrijvers, and Martin Sulzmann. 2011. OutsideIn(X): Modular type inference with local assumptions. J. Funct. Program. 21, 4-5 ( 2011 ), 333-412. https://doi.org/10.1017/S0956796811000098 Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Dimitrios Vytiniotis, Stephanie Weirich, and Simon L. Peyton Jones. 2006. Boxy types: inference for higher-rank types and impredicativity. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming, ICFP 2006, Portland, Oregon, USA, September 16-21, 2006, John H. Reppy and Julia L. Lawall (Eds.). ACM, 251-262. https://doi.org/10.1145/1159803.1159838 Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Dimitrios Vytiniotis, Stephanie Weirich, and Simon L. Peyton Jones. 2008. FPH: first-class polymorphism for Haskell. In Proceeding of the 13th ACM SIGPLAN international conference on Functional programming, ICFP 2008, Victoria, BC, Canada, September 20-28, 2008. 295-306. https://doi.org/10.1145/1411204.1411246 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. J. B. Wells. 1993. Typability and Type Checking in the Second-Order Lambda-Calculus Are Equivalent and Undecidable. Technical Report. Boston, MA, USA.Google ScholarGoogle Scholar

Index Terms

  1. A quick look at impredicativity

    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!