Skip to main content Accessibility help
×
×
Home

Work it, wrap it, fix it, fold it

  • NEIL SCULTHORPE (a1) and GRAHAM HUTTON (a2)
Abstract

The worker/wrapper transformation is a general-purpose technique for refactoring recursive programs to improve their performance. The two previous approaches to formalising the technique were based upon different recursion operators and different correctness conditions. In this paper we show how these two approaches can be generalised in a uniform manner by combining their correctness conditions, extend the theory with new conditions that are both necessary and sufficient to ensure the correctness of the worker/wrapper technique, and explore the benefits that result. All the proofs have been mechanically verified using the Agda system.

Copyright
References
Hide All
Backhouse, R. (2002) Galois connections and fixed point calculus. In Algebraic and Coalgebraic Methods in the Mathematics of Program Construction, Backhouse, R., Crole, R. & Gibbons, J. (eds). New York, NY: Springer, pp. 89150
Bird, R. & de Moor, O. (1997) Algebra of Programming. Upper Saddle River, NJ: Prentice Hall.
Burstall, R. M., & Darlington, J. (1977) A transformation system for developing recursive programs. J. ACM 24 (1), 4467.
Farmer, A., Gill, A., Komp, E. & Sculthorpe, N. (2012) The HERMIT in the machine: A plugin for the interactive transformation of GHC core language programs. In Proceedings of the 2012 Haskell Symposium, Copenhagen, Denmark. New York, NY: ACM, pp. 112.
Gammie, P. (2011) Strict unwraps make worker/wrapper fusion totally correct. J. Funct. Program. 21 (2), 209213.
Gill, A. & Hutton, G. (2009) The worker/wrapper transformation. J. Funct. Program. 19 (2), 227251.
Hoare, T. (1972) Proof of correctness of data representations. Acta Inform. 1 (4), 271281.
Hutton, G., Jaskelioff, M., & Gill, A. (2010) Factorising folds for faster functions. J. Funct. Program. 20 (3&4), 353373.
Meijer, E., Fokkinga, M. M., & Paterson, R. (1991) Functional programming with bananas, lenses, envelopes and barbed wire. In Functional Programming Languages and Computer Architecture, Hughes, J. (ed). Berlin, Germany: Springer, pp. 124144.
Morgan, C. & Gardiner, P. H. B. (1990) Data refinement by calculation. Acta Inform. 27 (6), 481503.
Peyton Jones, S. & Launchbury, J. (1991) Unboxed values as first class citizens in a non-strict functional language. In Functional Programming Languages and Computer Architecture, Hughes, J. (ed). Berlin, Germany: Springer, pp. 636666.
Scherlis, W. L. (1980) Expression Procedures and Program Derivation. PhD thesis, Stanford University, Stanford, CA.
Schmidt, D. A. (1986) Denotational Semantics: A Methodology for Language Development. Boston, MA: Allyn & Bacon.
Sculthorpe, N., Farmer, A. & Gill, A. (2013) The HERMIT in the tree: Mechanizing program transformations in the GHC core language. In Implementation and Application of Functional Languages 2012, Hinze, R. (ed), Lecture Notes in Computer Science, vol. 8241. New York, NY: Springer, pp. 86103.
Tullsen, M. (2002) PATH, A Program Transformation System for Haskell. PhD thesis, Yale University, Yale. CT.
Voigtländer, J. (2008) Asymptotic improvement of computations over free monads. In Mathematics of Program Construction, Audebaud, P. & Paulin-Mohring, C. (eds), Lecture Notes in Computer Science, vol. 5133. New York, NY: Springer, pp. 388403.
Winskel, G. (1993) The Formal Semantics of Programming Languages – An Introduction. Foundation of Computing series. Cambridge, MA: MIT.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×
Type Description Title
UNKNOWN
Supplementary materials

SCULTHORPE and HUTTON supplementary material
Supplementary files

 Unknown (679 KB)
679 KB

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed

Work it, wrap it, fix it, fold it

  • NEIL SCULTHORPE (a1) and GRAHAM HUTTON (a2)
Submit a response

Discussions

No Discussions have been published for this article.

×

Reply to: Submit a response


Your details


Conflicting interests

Do you have any conflicting interests? *