1999 · 45 citations · 14 references
ComputingComputer ScienceAlgorithmsCompilersProgramming LanguagesData TypesDeforestationFunctional ProgrammingIntermediate RepresentationType CheckingType SystemsData Type InferenceParametricityPolymorphic Type SystemsPolymorphic TypesRule-based TransformationType ConversionType InferenceTyped Lambda Calculus
Deforestation optimises a functional program by transforming it into another one that does not create certain intermediate data structures. Short cut deforestation is a deforestation method which is based on a single, local transformation rule. In return, short cut deforestation expects both producer and consumer of the intermediate structure in a certain form. Warm fusion wan proposed to automatically transform functions into this form. Unfortunately, it is costly and hard to implement. Starting from the fact that short cut deforestation is based on a parametricity theorem of the second-order typed λ-calculus, we show how the required form of a list producer can be derived by the use of type inference. Typability for the second-order typed λ-calculus is undecidable. However, we present a linear-time algorithm that solves a partial type inference problem and that, together with controlled inlining and polymorphic type instantiation, suffices for deforestation. The resulting new short cut deforestation algorithm is efficient and removes more intermediate lists than the original.
14
Philip Wadler · 1989 · 776 citations
Why Functional Programming Matters
John Hughes · The Computer Journal · 1989 · 739 citations · Full text
Deforestation: transforming programs to eliminate trees
Philip Wadler · Theoretical Computer Science · 1990 · 707 citations
Andrew Gill, John Launchbury, Simon Jones · 1993 · 415 citations · Full text