FPH: first-class polymorphism for Haskell

Dimitrios Vytiniotis, Stephanie Weirich, Simon L. Peyton Jones. FPH: first-class polymorphism for Haskell. In James Hook, Peter Thiemann, editors, Proceeding of the 13th ACM SIGPLAN international conference on Functional programming, ICFP 2008, Victoria, BC, Canada, September 20-28, 2008. pages 295-306, ACM, 2008. [doi]


Languages supporting polymorphism typically have ad-hoc restrictions on where polymorphic types may occur. Supporting ``first-class'' polymorphism, by lifting those restrictions, is obviously desirable, but it is hard to achieve this without sacrificing type inference. We present a new type system for higher-rank and impredicative polymorphism that improves on earlier proposals: it is an extension of Damas-Milner; it relies only on System F types; it has a simple, declarative specification; it is robust to program transformations; and it enjoys a complete and decidable type inference algorithm.