Abstract
A language supporting polymorphism is a boon to programmers: they can express complex ideas once and reuse functions in a variety of situations. However, polymorphism is pain for compilers tasked with producing efficient code that manipulates concrete values.
This paper presents a new intermediate language that allows for efficient static compilation, while still supporting flexible polymorphism. Specifically, it permits polymorphism over not only the types of values, but also the representation of values, the arity of primitive machine functions, and the evaluation order of arguments---all three of which are useful in practice. The key insight is to encode information about a value's calling convention in the kind of its type, rather than in the type itself.
Supplemental Material
- Jean-Marc Andreoli. 1992. Logic Programming with Focusing Proofs in Linear Logic. Journal of Logic and Computation 2, 3 ( 1992 ), 297-347. https://doi.org/10.1093/logcom/2.3. 297 Google Scholar
Cross Ref
- Zena M. Ariola and Matthias Felleisen. 1997. The Call-By-Need Lambda Calculus. Journal of Functional Programming 7, 3 (May 1997 ), 265-301. https://doi.org/10.1017/S0956796897002724 Google Scholar
Digital Library
- Maximilian C. Bolingbroke and Simon L. Peyton Jones. 2009. Types Are Calling Conventions. In Proceedings of the 2nd ACM SIGPLAN Symposium on Haskell (Edinburgh, Scotland) ( Haskell '09). ACM, 1-12.Google Scholar
- Joachim Breitner. 2014. Call Arity. In Trends in Functional Programming-15th International Symposium, TFP 2014, Soesterberg, The Netherlands, May 26-28, 2014. Revised Selected Papers. 34-50.Google Scholar
- Joachim Breitner, Richard A. Eisenberg, Simon Peyton Jones, and Stephanie Weirich. 2016. Safe zero-cost coercions for Haskell. Journal of Functional Programming 26 ( 2016 ), e15. https://doi.org/10.1017/S0956796816000150 Google Scholar
Cross Ref
- Zaynah Dargaye and Xavier Leroy. 2009. A verified framework for higher-order uncurrying optimizations. Higher-Order and Symbolic Computation 22, 3 ( 2009 ), 199-231.Google Scholar
- Paul Downen and Zena M. Ariola. 2018. Beyond Polarity: Towards a Multi-Discipline Intermediate Language with Sharing. In 27th EACSL Annual Conference on Computer Science Logic, CSL 2018, September 4-7, 2018, Birmingham, UK. 21 : 1-21 : 23.Google Scholar
- Paul Downen, Zachary Sullivan, Zena M. Ariola, and Simon Peyton Jones. 2019. Making a Faster Curry with Extensional Types. In Proceedings of the 12th ACM SIGPLAN International Symposium on Haskell (Berlin, Germany) ( Haskell 2019 ). Association for Computing Machinery, New York, NY, USA, 58-70. https://doi.org/10.1145/3331545.3342594 Google Scholar
Digital Library
- Joshua Dunfield. 2015. Elaborating evaluation-order polymorphism. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming, ICFP 2015, Vancouver, BC, Canada, September 1-3, 2015. 256-268.Google Scholar
Digital Library
- Richard Eisenberg. 2019. GHC Proposal 29: revised levity polymorphism. https://github.com/ghc-proposals/ghc-proposals/ blob/master/proposals/0029-levity-polymorphism.rstGoogle Scholar
- Richard A. Eisenberg and Simon Peyton Jones. 2017. Levity polymorphism. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2017, Barcelona, Spain, June 18-23, 2017. 525-539.Google Scholar
- Sebastian Graf. 2020. GHC Proposal 265: unlifted data types. https://github.com/ghc-proposals/ghc-proposals/blob/master/ proposals/0265-unlifted-datatypes.rstGoogle Scholar
- John Hannan and Patrick Hicks. 1998. Higher-Order unCurrying. In POPL '98, Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Diego, CA, USA, January 19-21, 1998. 1-11.Google Scholar
Digital Library
- Jean-Louis Krivine. 2007. A Call-By-Name Lambda-Calculus Machine. Higher-Order and Symbolic Computation 20, 3 ( 2007 ), 199-207.Google Scholar
- Olivier Laurent. 2002. Étude de la polarisation en logique. Ph.D. Dissertation. Université de la Méditerranée-Aix-Marseille II.Google Scholar
- Xavier Leroy. 1990. The ZINC experiment: an economical implementation of the ML language. Technical report 117. INRIA.Google Scholar
- Paul Blain Levy. 2001. Call-By-Push-Value. Ph.D. Dissertation. Queen Mary and Westfield College, University of London.Google Scholar
- Simon Marlow and Simon L. Peyton Jones. 2004. Making a fast curry: push/enter vs. eval/apply for higher-order languages. In Proceedings of the Ninth ACM SIGPLAN International Conference on Functional Programming, ICFP 2004, Snow Bird, UT, USA, September 19-21, 2004. ACM, 4-15.Google Scholar
Digital Library
- Andrew Martin. 2019a. GHC Proposal 112: unlifted arrays. https://github.com/ghc-proposals/ghc-proposals/blob/master/ proposals/0112-unlifted-array.rstGoogle Scholar
- Andrew Martin. 2019b. GHC Proposal 203: pointer rep. https://github.com/ghc-proposals/ghc-proposals/blob/master/ proposals/0203-pointer-rep.rstGoogle Scholar
- Andrew Martin. 2019c. GHC Proposal 98: unlifted newtypes. https://github.com/ghc-proposals/ghc-proposals/blob/master/ proposals/0098-unlifted-newtypes.rstGoogle Scholar
- Dylan McDermott and Alan Mycroft. 2019. Extended Call-by-Push-Value : Reasoning About Efectful Programs and Evaluation Order. In Programming Languages and Systems, Luís Caires (Ed.). Springer International Publishing, Cham, 235-262.Google Scholar
- Guillaume Munch-Maccagnoni. 2009. Focalisation and Classical Realisability. In Computer Science Logic: 23rd international Workshop, CSL 2009, 18th Annual Conference of the EACSL (Coimbra, Portugal) (CSL 2009), Erich Grädel and Reinhard Kahle (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 409-423.Google Scholar
Cross Ref
- Guillaume Munch-Maccagnoni. 2013. Syntax and Models of a non-Associative Composition of Programs and Proofs. Ph.D. Dissertation. Université Paris Diderot.Google Scholar
- Simon L. Peyton Jones. 1992. Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-machine. Journal of Functional Programming 2, 2 ( 1992 ), 127-202.Google Scholar
- Simon L. Peyton Jones and John Launchbury. 1991. Unboxed Values As First Class Citizens in a Non-Strict Functional Language. In Proceedings of the 5th ACM Conference on Functional Programming Languages and Computer Architecture. Springer-Verlag, London, UK, UK, 636-666.Google Scholar
- Amr Sabry and Matthias Felleisen. 1993. Reasoning About Programs in Continuation-Passing Style. Lisp and Symbolic Computation 6, 3-4 ( Nov. 1993 ), 289-360.Google Scholar
Digital Library
- Amr Sabry and Philip Wadler. 1997. A Reflection on Call-by-Value. ACM Transactions on Programming Languages and Systems 19, 6 ( 1997 ), 916-941.Google Scholar
Digital Library
- Alex Theriault. 2019. GHC Proposal 209: levity-polymorphic Lift. https://github.com/ghc-proposals/ghc-proposals/blob/ master/proposals/0209-levity-polymorphic-lift.rstGoogle Scholar
- Philip Wadler, Walid Taha, and David Macqueen. 1998. How to add laziness to a strict language without even being odd. In Proceedings of the Standard ML Workshop.Google Scholar
- Stephanie Weirich, Justin Hsu, and Richard A. Eisenberg. 2013. System FC with Explicit Kind Equality. In International Conference on Functional Programming (Boston, Massachusetts, USA) ( ICFP '13). ACM.Google Scholar
- Noam Zeilberger. 2008. On the Unity of Duality. Annals of Pure and Applied Logic 153, 1 ( 2008 ), 660-96.Google Scholar
Cross Ref
- Noam Zeilberger. 2009. The Logical Basis of Evaluation Order and Pattern-Matching. Ph.D. Dissertation. Carnegie Mellon University.Google Scholar
Digital Library
Index Terms
Kinds are calling conventions
Recommendations
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 ...
Polymorphic type inference for machine code
PLDI '16For many compiled languages, source-level types are erased very early in the compilation process. As a result, further compiler passes may convert type-safe source into type-unsafe machine code. Type-unsafe idioms in the original source and type-unsafe ...






Comments