Applicative Shortcut Fusion

  • Germán Andrés Delbianco
  • Mauro Jaskelioff
  • Alberto Pardo
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7193)

Abstract

In functional programming one usually writes programs as the composition of simpler functions. Consequently, the result of a function might be generated only to be consumed immediately by another function. This potential source of inefficiency can often be eliminated using a technique called shortcut fusion, which fuses both functions involved in a composition to yield a monolithic one. In this article we investigate how to apply shortcut fusion to applicative computations. Applicative functors provide a model of computational effects which generalise monads, but they favour an applicative programming style. To the best of our knowledge, this is the first time shortcut fusion is considered in an applicative setting.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Abramsky, S., Jung, A.: Domain Theory. In: Abramsky, S., Gabbay, D., Maibaum, T.S.E. (eds.) Handbook of Logic in Computer Science, vol. 3, pp. 1–168. Oxford University Press (1994)Google Scholar
  2. 2.
    Backhouse, R., Jansson, P., Jeuring, J., Meertens, L.: Generic Programming — An Introduction. In: Swierstra, S.D., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 28–115. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  3. 3.
    Bird, R., de Moor, O.: Algebra of programming. Prentice-Hall, Inc., Upper Saddle River (1997)MATHGoogle Scholar
  4. 4.
    Bird, R.S.: Introduction to Functional Programming Using Haskell. Prentice-Hall (1998)Google Scholar
  5. 5.
    Fernandes, J.P., Pardo, A., Saraiva, J.: A shortcut fusion rule for circular program calculation. In: Keller, G. (ed.) Haskell, pp. 95–106. ACM (2007)Google Scholar
  6. 6.
    Ghani, N., Johann, P.: Monadic augment and generalised short cut fusion. Journal of Functional Programming 17(6), 731–776 (2007)MathSciNetMATHCrossRefGoogle Scholar
  7. 7.
    Ghani, N., Johann, P.: Short cut fusion of recursive programs with computational effects. In: Achten, P., Koopman, P., Morazán, M. (eds.) Trends in Functional Programming. Trends in Functional Programming, Intellect, vol. 9, pp. 113–128 (2009) ISBN 978-1-84150-277-9Google Scholar
  8. 8.
    Ghani, N., Uustalu, T., Vene, V.: Build, Augment and Destroy, Universally. In: Chin, W.-N. (ed.) APLAS 2004. LNCS, vol. 3302, pp. 327–347. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  9. 9.
    Gibbons, J.: Datatype-Generic Programming. In: Backhouse, R., Gibbons, J., Hinze, R., Jeuring, J. (eds.) SSDGP 2006. LNCS, vol. 4719, pp. 1–71. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  10. 10.
    Gibbons, J., Oliveira, B.C.d.S.: The essence of the iterator pattern. Journal of Functional Programming 19(3-4), 377–402 (2009)MathSciNetMATHCrossRefGoogle Scholar
  11. 11.
    Gill, A., Launchbury, J., Peyton Jones, S.: A short cut to deforestation. In: FPCA 1993: Proceedings of the Conference on Functional Programming Languages and Computer Architecture, pp. 223–232. ACM Press, New York (1993)CrossRefGoogle Scholar
  12. 12.
    Hughes, J.: Why functional programming matters. Comput. J. 32(2), 98–107 (1989)CrossRefGoogle Scholar
  13. 13.
    Johann, P., Ghani, N.: Monadic fold, monadic build, monadic short cut fusion. In: Proceedings of the 10th Symposium on Trends in Functional Programming (TFP 2009), pp. 9–23 (2009)Google Scholar
  14. 14.
    Manzino, C., Pardo, A.: Shortcut fusion of monadic programs. Journal of Universal Computer Science 14(21), 3431–3446 (2008)MATHGoogle Scholar
  15. 15.
    Martínez, M., Pardo, A.: A shortcut fusion approach to accumulations. In: Simpósio Brasileiro de Linguagens de Programacao, SBLP 2009 (2009)Google Scholar
  16. 16.
    McBride, C., Paterson, R.: Applicative programming with effects. Journal of Functional Programming 18(01), 1–13 (2008)MATHCrossRefGoogle Scholar
  17. 17.
    Meertens, L.: Functor pulling. In: Backhouse, R., Sheard, T. (eds.) Proc. Workshop on Generic Programming (1998)Google Scholar
  18. 18.
    Meijer, E., Fokkinga, M.M., Paterson, R.: Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 124–144. Springer, Heidelberg (1991)CrossRefGoogle Scholar
  19. 19.
    Pardo, A., Fernandes, J.P., Saraiva, J.: Shortcut fusion rules for the derivation of circular and higher-order monadic programs. In: Puebla, G., Vidal, G. (eds.) PEPM, pp. 81–90. ACM (2009)Google Scholar
  20. 20.
    Takano, A., Meijer, E.: Shortcut deforestation in calculational form. In: Proc. Conference on Functional Programming Languages and Computer Architecture, pp. 306–313. ACM Press (1995)Google Scholar
  21. 21.
    Wadler, P.: Theorems for Free! In: Proceedings of the 4th ACM Conference on Functional Programming Languages and Computer Architecture, FPCA 1989, pp. 347–359. ACM Press, New York (1989)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Germán Andrés Delbianco
    • 1
  • Mauro Jaskelioff
    • 2
  • Alberto Pardo
    • 3
  1. 1.IMDEA Software InstituteSpain
  2. 2.CIFASIS-CONICET/Universidad Nacional de RosarioArgentina
  3. 3.InCo, Universidad de la RepúblicaUruguay

Personalised recommendations