skip to main content
10.1145/2034675.2034682acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

A library writer's guide to shortcut fusion

Published: 22 September 2011 Publication History

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.

Supplementary Material

JPG File (_talk5.jpg)
MP4 File (_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.
[2]
D. Coutts, D. Stewart, and R. Leshchinskiy. Rewriting Haskell Strings. In PADL '07, volume 4354, pages 50--64. Springer-Verlag, 2007.
[3]
F. Dominguez. HFusion: a fusion tool based on Acid Rain plus extensions. Master thesis, Universidad de la República, 2009.
[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.
[5]
N. Ghani, T. Uustalu, and V. Vene. Build, augment and destroy. Universally. pages 327--347. In Asian Symposium on Programming Languages, Proceedings, 2004.
[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.
[7]
A. Gill and G. Hutton. The Worker Wrapper Transformation. Journal of Functional Programming, 19 (2): 227---251, 2009.
[8]
A. Gill, J. Launchbury, and S. L. Peyton Jones. A short cut to deforestation. ACM Press, New York, New York, USA, 1993.
[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.
[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.
[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.
[12]
C. A. R. Hoare. Proof of correctness of data representations. Acta Informatica, 1: 271--281, 1972. ISSN 0001-5903.
[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.
[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.
[15]
J. Launchbury and T. Sheard. Warm fusion: deriving build-catas from recursive definitions. Functional Programming Languages and Computer Architecture, page 314, 1995.
[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.
[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.
[18]
A. Takano and E. Meijer. Shortcut deforestation in calculational form. Functional Programming Languages and Computer Architecture, page 306, 1995.
[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.
[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.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
Haskell '11: Proceedings of the 4th ACM symposium on Haskell
September 2011
136 pages
ISBN:9781450308601
DOI:10.1145/2034675
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 46, Issue 12
    Haskell '11
    December 2011
    129 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2096148
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 22 September 2011

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. deforestation
  2. functional programming
  3. optimisation
  4. program fusion
  5. program transformation
  6. shortcut fusion

Qualifiers

  • Research-article

Conference

ICFP '11
Sponsor:

Acceptance Rates

Overall Acceptance Rate 57 of 143 submissions, 40%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)15
  • Downloads (Last 6 weeks)2
Reflects downloads up to 07 Nov 2024

Other Metrics

Citations

Cited By

View all

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media