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]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[16]  A. Pitts Parametric polymorphism and operational equivalence , 2000, Mathematical Structures in Computer Science.

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

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

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

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

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

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

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