Concatenate, reverse and map vanish for free

We introduce a new transformation method to eliminate intermediate data structures occurring in functional programs due to repeated list concatenations and other data manipulations (additionally exemplified with list reversal and mapping of functions over lists).The general idea is to uniformly abstract from data constructors and manipulating operations by means of rank-2 polymorphic combinators that exploit algebraic properties of these operations to provide an optimized implementation. The correctness of transformations is proved by using the free theorems derivable from parametric polymorphic types.

[1]  Daniel Leivant,et al.  Polymorphic type inference , 1983, POPL '83.

[2]  Bruce J. McAdam,et al.  Repairing type errors in functional programs , 2002 .

[3]  Philip Wadler The Concatenate Vanishes , 1987 .

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

[5]  Walid Taha,et al.  Semantics, Applications, and Implementation of Program Generation , 2001, Lecture Notes in Computer Science.

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

[7]  Peter D. Mosses,et al.  Denotational semantics , 1995, LICS 1995.

[8]  S. Jones,et al.  A Transformation-Based Optimiser for Haskell , 1998, Sci. Comput. Program..

[9]  Andrew Moran,et al.  Improvement in a lazy context: an operational theory for call-by-need , 1999, POPL '99.

[10]  Joyce L. Vedral,et al.  Functional Programming Languages and Computer Architecture , 1989, Lecture Notes in Computer Science.

[11]  Andrew John Gill,et al.  Cheap deforestation for non-strict functional languages , 1996 .

[12]  David A. Schmidt,et al.  Denotationaisemantics: a methodology for language development , 1986 .

[13]  Gregory John Michaelson,et al.  Improved Type Error Reporting , 2000 .

[14]  Olaf Chitil,et al.  Compositional explanation of types and algorithmic debugging of type errors , 2001, ICFP '01.

[15]  John Hughes,et al.  A Novel Representation of Lists and its Application to the Function "reverse" , 1986, Inf. Process. Lett..

[16]  Josef Svenningsson Shortcut fusion for accumulating parameters & zip-like functions , 2002, ICFP '02.

[17]  Olaf Chitil,et al.  Typer inference builds a short cut to deforestation , 1999, ICFP '99.

[18]  Germán Vidal,et al.  Improving Functional Logic Programs by Difference-Lists , 2000, ASIAN.

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

[20]  John Hughes,et al.  The Design of a Pretty-printing Library , 1995, Advanced Functional Programming.

[21]  Richard S. Bird The promotion and accumulation strategies in transformational programming , 1984, TOPL.

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

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

[24]  Eerke A. Boiten The Many Disguises of Accumulation , 1991 .

[25]  Robert Glück,et al.  Relating Accumulative and Non-accumulative Functional Programs , 2001, RTA.

[26]  Andrew M. Pitts,et al.  Parametric polymorphism and operational equivalence , 2000, Mathematical Structures in Computer Science.

[27]  Olaf Chitil,et al.  Type-inference based deforestation of functional programs , 2000 .

[28]  Patricia Johann Short Cut Fusion: Proved and Improved , 2001, SAIG.