The worker/wrapper transformation

The worker/wrapper transformation is a technique for changing the type of a computation, usually with the aim of improving its performance. It has been used by compiler writers for many years, but the technique is little known in the wider functional programming community, and has never been described precisely. In this article we explain, formalise and explore the generality of the worker/wrapper transformation. We also provide a systematic recipe for its use as an equational reasoning technique for improving the performance of programs, and illustrate the power of this recipe using a range of examples.

[1]  Graham Hutton,et al.  Calculating an exceptional machine , 2004, Trends in Functional Programming.

[2]  Graham Hutton,et al.  Compiling Exceptions Correctly , 2004, MPC.

[3]  John Darlington,et al.  A Transformation System for Developing Recursive Programs , 1977, J. ACM.

[4]  J. Michael Spivey,et al.  A Functional Theory of Exceptions , 1990, Sci. Comput. Program..

[5]  Roland Carl Backhouse,et al.  Galois Connections and Fixed Point Calculus , 2000, Algebraic and Coalgebraic Methods in the Mathematics of Program Construction.

[6]  Jeremy Gibbons,et al.  The under-appreciated unfold , 1998, ICFP '98.

[7]  Maarten M. Fokkinga,et al.  Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire , 1991, FPCA.

[8]  André L. M. Santos,et al.  Compilation by transformation in non-strict functional languages , 1995 .

[9]  Irwin E. Perlin,et al.  Proceedings of the ACM annual conference , 1973 .

[10]  Andy Gill Introducing the Haskell equational reasoning assistant , 2006, Haskell '06.

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

[12]  Simon L. Peyton Jones,et al.  The Glasgow Haskell Compiler: A Retrospective , 1992, Functional Programming.

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

[14]  Thorsten Altenkirch,et al.  Representations of First Order Function Types as Terminal Coalgebras , 2001, TLCA.

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

[16]  James Cheney,et al.  Mechanized metatheory model-checking , 2007, PPDP '07.

[17]  Cyril S. Ku,et al.  Design Patterns , 2008, Wiley Encyclopedia of Computer Science and Engineering.

[18]  John C. Reynolds,et al.  Definitional Interpreters for Higher-Order Programming Languages , 1972, ACM '72.

[19]  Andrew M. Pitts,et al.  Higher order operational techniques in semantics , 1999 .

[20]  Roland Carl Backhouse,et al.  Categorical Fixed Point Calculus , 1995, Category Theory and Computer Science.

[21]  Roland Carl Backhouse,et al.  Algebraic and Coalgebraic Methods in the Mathematics of Program Construction , 2000, Lecture Notes in Computer Science.

[22]  C. A. R. Hoare,et al.  Proof of correctness of data representations , 1972, Acta Informatica.

[23]  Simon Peyton Jones,et al.  Playing by the rules: rewriting as a practical optimisation technique in GHC , 2001 .

[24]  Ralf Hinze Functional pearl: streams and unique fixed points , 2008, ICFP.

[25]  Richard S. Bird,et al.  Introduction to functional programming using haskeu , 1998 .

[26]  Richard S. Bird,et al.  Introduction to functional programming , 1988, Prentice Hall International series in computer science.

[27]  Graham Hutton,et al.  Programming in Haskell , 2007 .

[28]  Christopher G. Lasater,et al.  Design Patterns , 2008, Wiley Encyclopedia of Computer Science and Engineering.

[29]  Sam Lindley,et al.  Extensional Rewriting with Sums , 2007, TLCA.

[30]  Olaf Chitil,et al.  Type-Inference Based Short Cut Deforestation (Nearly) without Inlining , 1999, IFL.

[31]  Simon Peyton Jones,et al.  Measuring the effectiveness of a simple strictness analyser , 1993, Functional Programming.

[32]  Hayo Thielecke,et al.  Comparing Control Constructs by Double-Barrelled CPS , 2002, High. Order Symb. Comput..

[33]  David Sands,et al.  Improvement theory and its applications , 1999 .

[34]  Graham Hutton,et al.  A tutorial on the universality and expressiveness of fold , 1999, Journal of Functional Programming.

[35]  Graham Hutton,et al.  Proof Methods for Corecursive Programs , 2005, Fundam. Informaticae.

[36]  R. Bird Introduction to functional programming using Haskell, Second Edition , 1998 .

[37]  John Launchbury,et al.  Warm fusion: deriving build-catas from recursive definitions , 1995, FPCA '95.

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

[39]  DONALD MICHIE,et al.  “Memo” Functions and Machine Learning , 1968, Nature.

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

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

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

[43]  Graham Hutton,et al.  What is the meaning of these constant interruptions? , 2007, Journal of Functional Programming.

[44]  Olivier Danvy,et al.  A functional correspondence between evaluators and abstract machines , 2003, PPDP '03.

[45]  Philip Wadler,et al.  Monads for functional programming , 1995, NATO ASI PDC.

[46]  Conor McBride,et al.  Applicative programming with effects , 2008, J. Funct. Program..

[47]  Pieter H. Hartel,et al.  Proceedings of the First International Symposium on Functional Programming Languages in Education , 1995 .

[48]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[49]  Roman Leshchinskiy,et al.  Stream fusion: from lists to streams to nothing at all , 2007, ICFP '07.

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