Extending Deforestation for First Order functional Programs

Intermediate data structures are widely used in functional programs. Programs which use these intermediate structures are usually a lot easier to understand, but they result in loss of efficiency at run time. In order to reduce these run-time costs, a transformation algorithm called deforestation was proposed by Wadler which could eliminate intermediate structures. However, this algorithm is only applicable to a subset of all first-order functional terms. In this paper, it is shown how deforestation can be extended to be made applicable to all first-order functional terms. This is achieved by performing static analysis to determine which intermediate data structures can be eliminated. Using this extended form of deforestation, the majority of garbage which can be detected at compile-time will not be generated at run-time.

[1]  Wei-Ngan Chin,et al.  Automatic methods for program transformation , 1990 .

[2]  Philip Wadler,et al.  Glasgow Workshop on Functional Programming , 1992 .

[3]  Alan Mycroft,et al.  Abstract interpretation and optimising transformations for applicative programs , 1982 .

[4]  W.-N. Chin Generalising Deforestation for All First-Order Functional Programs , 1991, JTASPEFT/WSA.

[5]  Geoff W. Hamilton,et al.  Transforming Programs to Eliminate Intermediate Structures , 1991, JTASPEFT/WSA.

[6]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[7]  John Hughes,et al.  Why Functional Programming Matters , 1989, Comput. J..

[8]  Katsuro Inoue,et al.  Analysis of functional programs to detect run-time garbage cells , 1988, TOPL.

[9]  Geoff W. Hamilton,et al.  Compile-Time Garbage Collection by Necessity Analysis , 1990, Functional Programming.

[10]  Philip Wadler,et al.  Deforestation: Transforming Programs to Eliminate Trees , 1988, Theoretical Computer Science.

[11]  Philip Wadler Listlessness is better than laziness II: composing listless functions , 1985, Programs as Data Objects.

[12]  Philip Wadler,et al.  When Will Deforestation Stop , 1988 .

[13]  Daniel Le Métayer,et al.  Computer-Time Garbage Collection by Sharing Analysis , 1989, FPCA.

[14]  Lennart Augustsson,et al.  Compiling Pattern Matching , 1985, FPCA.

[15]  Philip Wadler,et al.  Listlessness is better than laziness: Lazy evaluation and garbage collection at compile-time , 1984, LFP '84.