Open Access. Powered by Scholars. Published by Universities.®

Physical Sciences and Mathematics Commons

Open Access. Powered by Scholars. Published by Universities.®

Programming Languages and Compilers

Computer Science Faculty Research and Scholarship

Compilation

Articles 1 - 1 of 1

Full-Text Articles in Physical Sciences and Mathematics

Levity Polymorphism, Richard A. Eisenberg, Simon Peyton Jones Jun 2017

Levity Polymorphism, Richard A. Eisenberg, Simon Peyton Jones

Computer Science Faculty Research and Scholarship

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.