Abstract
We study various shortcut fusion rules for languages like Haskell. Following a careful semantic account of a recently proposed rule for circular program transformation, we propose a new rule that trades circularity for higher-orderedness, and thus attains better semantic properties. This also leads us to revisit the original foldr/build-rule, as well as its dual, and to develop variants that do not suffer from detrimental impacts of Haskell’s mixed strict/nonstrict semantics. Throughout, we offer pragmatic insights about our new rules to investigate also their relative effectiveness, rather than just their semantic correctness.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Coutts, D., Leshchinskiy, R., Stewart, D.: Stream fusion: From lists to streams to nothing at all. In: International Conference on Functional Programming, Proceedings, pp. 315–326. ACM Press, New York (2007)
Domínguez, F., Pardo, A.: Program fusion with paramorphisms. In: Mathematically Structured Functional Programming, Proceedings. Electronic Workshops in Computing, British Computer Society (2006)
Fernandes, J.P., Pardo, A., Saraiva, J.: A shortcut fusion rule for circular program calculation. In: Haskell Workshop, Proceedings, pp. 95–106. ACM Press, New York (2007)
Gill, A., Launchbury, J., Peyton Jones, S.L.: A short cut to deforestation. In: Functional Programming Languages and Computer Architecture, Proceedings, pp. 223–232. ACM Press, New York (1993)
Johann, P.: A generalization of short-cut fusion and its correctness proof. Higher-Order and Symbolic Computation 15(4), 273–300 (2002)
Johann, P., Voigtländer, J.: The impact of \(\mathit{seq}\) on free theorems-based program transformations. Fundamenta Informaticae 69(1–2), 63–102 (2006)
Pettorossi, A., Proietti, M.: Importing and exporting information in program development. In: Partial Evaluation and Mixed Computation, Proceedings, pp. 405–425. North-Holland, Amsterdam (1987)
Peyton Jones, S.L.: Call-pattern specialisation for Haskell programs. In: International Conference on Functional Programming, Proceedings, pp. 327–337. ACM Press, New York (2007)
Peyton Jones, S.L., Lester, D.: A modular fully-lazy lambda lifter in Haskell. Software Practice and Experience 21(5), 479–506 (1991)
Svenningsson, J.: Shortcut fusion for accumulating parameters & zip-like functions. In: International Conference on Functional Programming, Proceedings, pp. 124–132. ACM Press, New York (2002)
Takano, A., Meijer, E.: Shortcut deforestation in calculational form. In: Functional Programming Languages and Computer Architecture, Proceedings, pp. 306–313. ACM Press, New York (1995)
Voigtländer, J.: Concatenate, reverse and map vanish for free. In: International Conference on Functional Programming, Proceedings, pp. 14–25. ACM Press, New York (2002)
Voigtländer, J.: Using circular programs to deforest in accumulating parameters. Higher-Order and Symbolic Computation 17(1–2), 129–163 (2004)
Voigtländer, J.: Proving correctness via free theorems: The case of the destroy/build-rule. In: Partial Evaluation and Semantics-Based Program Manipulation, Proceedings, pp. 13–20. ACM Press, New York (2008)
Wadler, P.: Theorems for free! In: Functional Programming Languages and Computer Architecture, Proceedings, pp. 347–359. ACM Press, New York (1989)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2008 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Voigtländer, J. (2008). Semantics and Pragmatics of New Shortcut Fusion Rules. In: Garrigue, J., Hermenegildo, M.V. (eds) Functional and Logic Programming. FLOPS 2008. Lecture Notes in Computer Science, vol 4989. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-78969-7_13
Download citation
DOI: https://doi.org/10.1007/978-3-540-78969-7_13
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-78968-0
Online ISBN: 978-3-540-78969-7
eBook Packages: Computer ScienceComputer Science (R0)