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.
Supplemental Material
- Lennart Augustsson. 2011. Impredicative polymorphism: a use case. http://augustss.blogspot.com/ 2011 /07/impredicativepolymorphism-use-case-in.html.Google Scholar
- 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 Scholar
Digital Library
- Didier Le Botlan and Didier Rémy. 2009. Recasting MLF. Inf. Comput. 207, 6 ( 2009 ), 726-785.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- Martin Odersky and Konstantin Läufer. 1996. Putting type annotations to work. In Principles of Programming Languages, POPL. 54-67.Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Simon Peyton Jones. 2019. GHC Proposal: “Simplify subsumption”. https://github.com/ghc-proposals/ghc-proposals/pull/ 287Google Scholar
- 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 Scholar
- Frank Pfenning. 1995. On the Undecidability of Partial Polymorphic Type Reconstruction. Fundamenta Informaticae 19 ( 1995 ). Issue 1/2.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- J. B. Wells. 1993. Typability and Type Checking in the Second-Order Lambda-Calculus Are Equivalent and Undecidable. Technical Report. Boston, MA, USA.Google Scholar
Index Terms
A quick look at impredicativity
Recommendations
Elaboration with first-class implicit function types
Implicit functions are dependently typed functions, such that arguments are provided (by default) by inference machinery instead of programmers of the surface language. Implicit functions in Agda are an archetypal example. In the Haskell language as ...
Guarded impredicative polymorphism
PLDI '18The design space for type systems that support impredicative instantiation is extremely complicated. One needs to strike a balance between expressiveness, simplicity for both the end programmer and the type system implementor, and how easily the system ...
Guarded impredicative polymorphism
PLDI 2018: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and ImplementationThe design space for type systems that support impredicative instantiation is extremely complicated. One needs to strike a balance between expressiveness, simplicity for both the end programmer and the type system implementor, and how easily the system ...






Comments