Programs for Cheap!

Write down the definition of a recursion operator on a piece of paper. Tell me its type, but be careful not to let me see the operator's definition. I will tell you an optimization theorem that the operator satisfies. As an added bonus, I will also give you a proof of correctness for the optimisation, along with a formal guarantee about its effect on performance. The purpose of this paper is to explain these tricks.

[1]  Tony Hoare,et al.  Data Refinement in a Categorical Setting , 1987 .

[2]  Graham Hutton,et al.  The worker/wrapper transformation , 2009, Journal of Functional Programming.

[3]  Ross Paterson,et al.  A new notation for arrows , 2001, ICFP '01.

[4]  Ralph-Johan Back,et al.  Refinement Calculus: A Systematic Introduction , 1998 .

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

[6]  Gordon D. Plotkin,et al.  Complete axioms for categorical fixed-point operators , 2000, Proceedings Fifteenth Annual IEEE Symposium on Logic in Computer Science (Cat. No.99CB36332).

[7]  Daniel Seidel,et al.  Improvements for Free , 2011, QAPL.

[8]  David Sands From SOS rules to proof principles: an operational metatheory for functional languages , 1997, POPL '97.

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

[10]  Ed Komp,et al.  The HERMIT in the machine: a plugin for the interactive transformation of GHC core language programs , 2012, Haskell.

[11]  Simon L. Peyton Jones,et al.  Formally based profiling for higher-order functional languages , 1997, TOPL.

[12]  Jennifer Hackett,et al.  Worker/wrapper/makes it/faster , 2014, ICFP.

[13]  David Sands,et al.  Operational Theories of Improvement in Functional Languages (Extended Abstract) , 1991, Functional Programming.

[14]  Tarmo Uustalu,et al.  Build, Augment and Destroy, Universally , 2004, APLAS.

[15]  Patricia Johann,et al.  Free theorems in the presence of seq , 2004, POPL.

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

[17]  Tarmo Uustalu,et al.  A Note on Strong Dinaturality, Initial Algebras and Uniform Parameterized Fixpoint Operators , 2010, FICS.

[18]  Graham Hutton,et al.  Factorising folds for faster functions , 2010, J. Funct. Program..

[19]  Andre Scedrov,et al.  Functorial Polymorphism , 1990, Theor. Comput. Sci..

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

[21]  Will Partain,et al.  The nofib Benchmark Suite of Haskell Programs , 1992, Functional Programming.

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

[23]  John Hughes,et al.  Generalising monads to arrows , 2000, Sci. Comput. Program..

[24]  Andy Gill,et al.  The HERMIT in the Tree - Mechanizing Program Transformations in the GHC Core Language , 2012, IFL.

[25]  David Sands,et al.  Possibilities and limitations of call-by-need space improvement , 2001, ICFP '01.

[26]  Alex K. Simpson A Characterisation of the Least-Fixed-Point Operator by Dinaturality , 1993, Theor. Comput. Sci..

[27]  Jennifer Hackett,et al.  The Under-Performing Unfold: A new approach to optimising corecursive programs , 2013, IFL '13.

[28]  John Launchbury,et al.  Recursive monadic bindings , 2000, ICFP '00.

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

[30]  David Sands,et al.  A Foundation for Space-Safe Transformations of Call-by-Need Programs , 1999, HOOTS.

[31]  E. Riehl Basic concepts of enriched category theory , 2014 .

[32]  Duncan Coutts,et al.  Stream fusion : practical shortcut fusion for coinductive sequence types , 2011 .

[33]  Graham Hutton,et al.  Work it, wrap it, fix it, fold it , 2014, J. Funct. Program..

[34]  Gérard P. Huet,et al.  A Unification Algorithm for Typed lambda-Calculus , 1975, Theor. Comput. Sci..