Abstract
Parametric polymorphism is one of the linchpins of modern typed programming, but it comes with a real performance penalty. We describe this penalty; offer a principled way to reason about it (kinds as calling conventions); and propose levity polymorphism. This new form of polymorphism allows abstractions over calling conventions; we detail and verify restrictions that are necessary in order to compile levity-polymorphic functions. Levity polymorphism has created new opportunities in Haskell, including the ability to generalize nearly half of the type classes in GHC's standard library.
- K. Crary. Toward a foundational typed assembly language. In Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’03, pages 198–212. ACM, 2003. Google Scholar
Digital Library
- K. Crary and S. Weirich. Flexible type analysis. In Proceedings of the Fourth ACM SIGPLAN International Conference on Functional Programming, ICFP ’99, pages 233–248. ACM, 1999. Google Scholar
Digital Library
- J. Dunfield. Elaborating evaluation-order polymorphism. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming, ICFP 2015, pages 256–268. ACM, 2015. Google Scholar
Digital Library
- R. A. Eisenberg. Dependent Types in Haskell: Theory and Practice. PhD thesis, University of Pennsylvania, 2016.Google Scholar
- R. A. Eisenberg and S. Peyton Jones. Levity polymorphism (extended version). Technical report, Bryn Mawr College, 2017.Google Scholar
- S. Finne, D. Leijen, E. Meijer, and S. Peyton Jones. Calling Hell from Heaven and Heaven from Hell. In ACM SIGPLAN International Conference on Functional Programming (ICFP’99), pages 114–125, Paris, Sept. 1999. ACM. Google Scholar
Digital Library
- C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation, PLDI ’93, pages 237–247. ACM, 1993. Google Scholar
Digital Library
- J.-Y. Girard. 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 J. Fenstad, editor, Proceedings of the Second Scandinavian Logic Symposium, volume 63 of Studies in Logic and the Foundations of Mathematics, pages 63 – 92. Elsevier, 1971.Google Scholar
- D. Grossman. Quantified types in an imperative language. ACM Trans. Program. Lang. Syst., 28(3):429–475, May 2006. Google Scholar
Digital Library
- C. V. Hall, K. Hammond, S. L. Peyton Jones, and P. L. Wadler. Type classes in haskell. ACM Trans. Program. Lang. Syst., 18 (2), Mar. 1996. Google Scholar
Digital Library
- T. Jim, G. Morrisett, D. Grossman, M. Hicks, J. Cheney, and Y. Wang. Cyclone: A safe dialect of C. In Proceedings of the USENIX Annual Technical Conference, pages 275–288, 2002. Google Scholar
Digital Library
- A. Kennedy and D. Syme. Design and implementation of generics for the .NET Common Language Runtime. In Programming Language Design and Implementation. ACM, January 2001. Google Scholar
Digital Library
- R. Lämmel and S. Peyton Jones. Scrap your boilerplate: A practical design pattern for generic programming. In Workshop on Types in Languages Design and Implementation. ACM, 2003. Google Scholar
Digital Library
- G. Mainland, S. Marlow, R. Leshchinskiy, and S. Peyton Jones. Exploiting vector instructions with generalized stream fusion. In ACM SIGPLAN International Conference on Functional Programming (ICFP ’13). ACM, September 2013. Google Scholar
Digital Library
- S. Marlow (editor). Haskell 2010 language report, 2010.Google Scholar
- G. Morrisett, D. Walker, K. Crary, and N. Glew. From System F to typed assembly language. ACM Trans. Program. Lang. Syst., 21(3):527–568, May 1999. Google Scholar
Digital Library
- A. Mycroft. Polymorphic type schemes and recursive definitions. Springer, Berlin, Heidelberg, 1984.Google Scholar
Cross Ref
- M. Naftalin and P. Wadler. Java Generics and Collections: Speed Up the Java Development Process. O’Reilly Media, 2006. Google Scholar
Digital Library
- M. Odersky and K. Läufer. Putting type annotations to work. In Symposium on Principles of Programming Languages, POPL ’96. ACM, 1996. Google Scholar
Digital Library
- S. Peyton Jones and J. Launchbury. Unboxed values as first class citizens. In FPCA, volume 523 of LNCS, pages 636–666, 1991. Google Scholar
Digital Library
- S. Peyton Jones and A. Santos. A transformation-based optimiser for Haskell. In Science of Computer Programming, volume 32, pages 3–47. Elsevier, October 1997. Google Scholar
Digital Library
- S. Peyton Jones, D. Vytiniotis, S. Weirich, and M. Shields. Practical type inference for arbitrary-rank types. Journal of Functional Programming, 17(1), Jan. 2007. Google Scholar
Digital Library
- S. Peyton Jones, S. Weirich, R. A. Eisenberg, and D. Vytiniotis. A reflection on types. In A list of successes that can change the world, LNCS. Springer, 2016. A festschrift in honor of Phil Wadler.Google Scholar
Cross Ref
- J. C. Reynolds. Towards a theory of type structure. In B. Robinet, editor, Programming Symposium, volume 19 of Lecture Notes in Computer Science, pages 408–425. Springer Berlin Heidelberg, 1974. Google Scholar
Digital Library
- M. Sulzmann, M. M. T. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In Types in languages design and implementation, TLDI ’07. ACM, 2007. Google Scholar
Digital Library
- D. Tarditi, G. Morrisett, P. Cheng, C. Stone, R. Harper, and P. Lee. TIL: A type-directed optimizing compiler for ML. In Proceedings of the ACM SIGPLAN ’96 Conference on Programming Language Design and Implementation, PLDI ’96, 1996. Google Scholar
Digital Library
- V. Ureche, A. Biboudis, Y. Smaragdakis, and M. Odersky. Automating ad hoc data representation transformations. In International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA ’15. ACM, 2015. Google Scholar
Digital Library
- P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad-hoc. In POPL, pages 60–76. ACM, 1989. Google Scholar
Digital Library
- S. Weeks. Whole-program compilation in MLton. Invited talk at ML Workshop, Sept. 2006. Google Scholar
Digital Library
- S. Weirich, J. Hsu, and R. A. Eisenberg. System FC with explicit kind equality. In International Conference on Functional Programming, ICFP ’13. ACM, 2013. Google Scholar
Digital Library
- B. A. Yorgey, S. Weirich, J. Cretin, S. Peyton Jones, D. Vytiniotis, and J. P. Magalhães. Giving Haskell a promotion. In Types in Language Design and Implementation, TLDI ’12. ACM, 2012. Google Scholar
Digital Library
Index Terms
Levity polymorphism
Recommendations
Levity polymorphism
PLDI 2017: Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and ImplementationParametric polymorphism is one of the linchpins of modern typed programming, but it comes with a real performance penalty. We describe this penalty; offer a principled way to reason about it (kinds as calling conventions); and propose levity ...
Type inference, principal typings, and let-polymorphism for first-class mixin modules
Proceedings of the tenth ACM SIGPLAN international conference on Functional programmingA mixin module is a programming abstraction that simultaneously generalizes λ-abstractions, records, and mutually recursive definitions. Although various mixin module type systems have been developed, no one has investigated principal typings or ...
Type inference, principal typings, and let-polymorphism for first-class mixin modules
ICFP '05: Proceedings of the tenth ACM SIGPLAN international conference on Functional programmingA mixin module is a programming abstraction that simultaneously generalizes λ-abstractions, records, and mutually recursive definitions. Although various mixin module type systems have been developed, no one has investigated principal typings or ...






Comments