skip to main content
research-article

A library writer's guide to shortcut fusion

Published:22 September 2011Publication History
Skip Abstract Section

Abstract

There are now a variety of shortcut fusion techniques in the wild for removing intermediate data structures in Haskell. They are often presented, however, specialised to a specific data structure and interface. This can make it difficult to transfer these techniques to other settings. In this paper, we give a roadmap for a library writer who would like to implement fusion for his own library. We explain shortcut fusion without reference to any specific implementation by treating it as an instance of data refinement. We also provide an example application of our framework using the features available in the Glasgow Haskell Compiler.

Skip Supplemental Material Section

Supplemental Material

_talk5.mp4

References

  1. D. Coutts, R. Leshchinskiy, and D. Stewart. Stream fusion. Proceedings of the 12th ACM SIGPLAN international conference on Functional programming (ICFP '07), 42 (9): 315--326, Oct. 2007. ISSN 03621340. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. D. Coutts, D. Stewart, and R. Leshchinskiy. Rewriting Haskell Strings. In PADL '07, volume 4354, pages 50--64. Springer-Verlag, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. F. Dominguez. HFusion: a fusion tool based on Acid Rain plus extensions. Master thesis, Universidad de la República, 2009.Google ScholarGoogle Scholar
  4. P. J. Freyd. Remarks on algebraically compact categories. In M. P. Fourman, P. T. Johnstone, and A. M. Pitts, editors, Applications of Categories in Computer Science, volume 177 of LMS Lecture Note Series, pages 95--106. Cambridge University Press, 1992.Google ScholarGoogle Scholar
  5. N. Ghani, T. Uustalu, and V. Vene. Build, augment and destroy. Universally. pages 327--347. In Asian Symposium on Programming Languages, Proceedings, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  6. J. Gibbons, G. Hutton, and T. Altenkirch. When is a function a fold or an unfold? In "Proceedings of the 4th International Workshop on Coalgebraic Methods in Computer Science". Elsevier Science, 2001.Google ScholarGoogle Scholar
  7. A. Gill and G. Hutton. The Worker Wrapper Transformation. Journal of Functional Programming, 19 (2): 227---251, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. A. Gill, J. Launchbury, and S. L. Peyton Jones. A short cut to deforestation. ACM Press, New York, New York, USA, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. T. Harper. Stream fusion on Haskell Unicode strings. In M. Morazán and S.-B. Scholz, editors, IFL'09 Proceedings of the 21st international conference on Implementation and application of functional languages, pages 125--140, Berlin, Sept. 2009. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Heine, B. Sørensen, and R. Glück. Introduction to Supercompilation. In J. Hatcliff, T. Mogensen, and P. Thiemann, editors, Partial Evaluation, volume 1706 of Lecture Notes in Computer Science, pages 246--270. Springer Berlin / Heidelberg, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Hinze, D. W. James, and T. Harper. Theory and practice of fusion. In J. Hage, editor, Pre-proceedings of the 22nd Symposium on the Implementation and Application of Functional Languages (IFL '10), pages 402--421, September 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. C. A. R. Hoare. Proof of correctness of data representations. Acta Informatica, 1: 271--281, 1972. ISSN 0001-5903.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. P. Johann and N. Ghani. phInitial algebra semantics is enough!, volume 4583 of Lecture Notes in Computer Science. Springer Berlin Heidelberg, Berlin, Heidelberg, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. S. P. Jones, A. Tolmach, and T. Hoare. Playing by the Rules: Rewriting as a practical optimisation technique in GHC. In Haskell Workshop, pages 203--233. ACM SIGPLAN, 2001.Google ScholarGoogle Scholar
  15. J. Launchbury and T. Sheard. Warm fusion: deriving build-catas from recursive definitions. Functional Programming Languages and Computer Architecture, page 314, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. S. L. Peyton-Jones and A. L. M. Santos. A transformation-based optimiser for Haskell. Science of Computer Programming, 32 (1-3): 3--47, Sept. 1998. ISSN 01676423. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. Svenningsson. Shortcut fusion for accumulating parameters & zip-like functions. In Proceedings of the seventh ACM SIGPLAN international conference on Functional programming - ICFP '02, volume 37, pages 124--132, New York, New York, USA, 2002. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. A. Takano and E. Meijer. Shortcut deforestation in calculational form. Functional Programming Languages and Computer Architecture, page 306, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. J. Voigtlander. Proving correctness via free theorems: the case of the destroy/build-rule. ACM/SIGPLAN Workshop Partial Evaluation and Semantics-Based Program Manipulation, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. P. Wadler. Theorems for free! In FPCA '89: Proceedings of the fourth international conference on Functional programming languages and computer architecture, pages 347---359, London, 1989. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A library writer's guide to shortcut fusion

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!