Bridging the gulf: a common intermediate language for ML and Haskell

Compilers for ML and Haskell use intermediate languages that incorporate deeply-embedded assumptions about order of evaluation and side effects. We propose an intermediate language into which one can compile both ML and Haskell, thereby facilitating the sharing of ideas and infrastructure, and supporting language developments that move each language in the direction of the other. Achieving this goal without compromising the ability to Compile as good code as a more direct route turned out to be much more subtle than we expected. We address this challenge using monads and unpointed types, identify two alternative language designs, and explore the choices they embody.

[1]  ScienceYale UniversityNew Haven An Overview of the Flint/ml Compiler , 1997 .

[2]  Paul Hudak,et al.  Modular Denotational Semantics for Compiler Construction , 1996, ESOP.

[3]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[4]  Mads Tofte,et al.  Type Inference for Polymorphic References , 1990, Inf. Comput..

[5]  Ralf Hinze,et al.  Haskell 98 — A Non−strict‚ Purely Functional Language , 1999 .

[6]  Uday S. Reddy,et al.  Imperative functional programming , 1996, CSUR.

[7]  Xavier Leroy,et al.  Unboxed objects and polymorphic typing , 1992, POPL '92.

[8]  John C. Mitchell,et al.  On the type structure of standard ML , 1993, TOPL.

[9]  Compiling actions by partial evaluation , 1993, FPCA '93.

[10]  Tatsuya Hagino,et al.  A categorical programming language , 2020, ArXiv.

[11]  Simon L. Peyton Jones,et al.  Concurrent Haskell , 1996, POPL '96.

[12]  Richard E. Jones,et al.  Tail recursion without space leaks , 1992, Journal of Functional Programming.

[13]  John Launchbury,et al.  Representing Demand by Partial Projections , 1996, J. Funct. Program..

[14]  Simon L. Peyton Jones,et al.  Compiling Haskell by Program Transformation: A Report from the Trenches , 1996, ESOP.

[15]  Mark P. Jones Dictionary-free overloading by partial evaluation , 1995, LISP Symb. Comput..

[16]  Philip Wadler,et al.  Comprehending monads , 1990, LISP and Functional Programming.

[17]  Simon L. Peyton Jones,et al.  State in Haskell , 1995, LISP Symb. Comput..

[18]  Simon L. Peyton Jones,et al.  A short cut to deforestation , 1993, FPCA '93.

[19]  Robin Milner,et al.  Definition of standard ML , 1990 .

[20]  Andrew W. Appel,et al.  A type-based compiler for standard ML , 1995, PLDI '95.

[21]  Robert Harper,et al.  Compiling polymorphism using intensional type analysis , 1995, POPL '95.

[22]  Flemming Nielson,et al.  Two-level functional languages , 1992, Cambridge tracts in theoretical computer science.

[23]  John C. Mitchell,et al.  Second-Order Logical Relations (Extended Abstract) , 1985, Logic of Programs.

[24]  Daniel P. Friedman,et al.  CONS Should Not Evaluate its Arguments , 1976, ICALP.

[25]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

[26]  Paul Hudak,et al.  Monad transformers and modular interpreters , 1995, POPL '95.

[27]  Philip Wadler,et al.  A reflection on call-by-value , 1997, TOPL.

[28]  Jens Palsberg,et al.  A Provably Correct Compiler Generator , 1992, ESOP.

[29]  Frank Pfenning,et al.  A modal analysis of staged computation , 1996, POPL '96.

[30]  Matthias Felleisen,et al.  A call-by-need lambda calculus , 1995, POPL '95.

[31]  John Launchbury,et al.  Unboxed values as first class citizens , 1991 .

[32]  Jean-Yves Girard,et al.  The System F of Variable Types, Fifteen Years Later , 1986, Theor. Comput. Sci..

[33]  Peter Lee Realistic compiler generation , 1989, Foundations of Computing Series.

[34]  Brian T. Howard Inductive, coinductive, and pointed types , 1996, ICFP '96.

[35]  Mark P. Jones,et al.  Using parameterized signatures to express modular structure , 1996, POPL '96.

[36]  Robert Harper,et al.  TIL: a type-directed optimizing compiler for ML , 1996, PLDI '96.

[37]  Dale Miller,et al.  A Logic Programming Language with Lambda-Abstraction, Function Variables, and Simple Unification , 1991, J. Log. Comput..

[38]  Charles Consel,et al.  A tour of Schism: a partial evaluation system for higher-order applicative languages , 1993, PEPM '93.

[39]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[40]  Simon L. Peyton Jones,et al.  Let-floating: moving bindings to give faster programs , 1996, ICFP '96.

[41]  Philip Wadler,et al.  The essence of functional programming , 1992, POPL '92.

[42]  Mark P. Jones A system of constructor classes: overloading and implicit higher-order polymorphism , 1993, FPCA '93.

[43]  Andrew M. Pitts,et al.  Relational Properties of Domains , 1996, Inf. Comput..

[44]  P. Wadler,et al.  A Reeection on Call-by-value , 1996 .

[45]  Paul Hudak,et al.  Modular monadic semantics and compilation , 1998 .

[46]  Walid Taha,et al.  Multi-stage programming with explicit annotations , 1997, PEPM.

[47]  Chris Okasaki,et al.  Purely functional data structures , 1998 .

[48]  Simon L. Peyton Jones,et al.  Unboxed Values as First Class Citizens in a Non-Strict Functional Language , 1991, FPCA.

[49]  John Launchbury,et al.  Parametricity and Unboxing with Unpointed Types , 1996, ESOP.

[50]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[51]  Martin Odersky,et al.  Putting type annotations to work , 1996, POPL '96.

[52]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[53]  Andrew W. Appel,et al.  Lambda-splitting: a higher-order approach to cross-module optimizations , 1997, ICFP '97.

[54]  B Lorho Methods and tools for compiler construction , 1984 .

[55]  Simon Peyton-Jones,et al.  Henk: A Typed Intermediate Language , 1997 .

[56]  Philip Wadler,et al.  Linear logic, monads and the lambda calculus , 1996, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[57]  Torben Æ. Mogensen Self-applicable Partial Evaluation for Pure Lambda Calculus , 1992, PEPM.

[58]  Amr Sabry,et al.  What is a purely functional language? , 1998, Journal of Functional Programming.

[59]  Zhong Shao Flexible representation analysis , 1997, ICFP '97.

[60]  D. A. Turner,et al.  Elementary Strong Functional Programming , 1995, FPLE.