Skip to main content

Merging monads and folds for functional programming

  • Conference paper
  • First Online:
Advanced Functional Programming (AFP 1995)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 925))

Included in the following conference series:

Abstract

These notes discuss the simultaneous use of generalised fold operators and monads to structure functional programs. Generalised fold operators structure programs after the decomposition of the value they consume. Monads structure programs after the computation of the value they produce. Our programs abstract both from the recursive processing of their input as well as from the side-effects in computing their output. We show how generalised monadic folds aid in calculating an efficient graph reduction engine from an inefficient specification.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. R.S. Bird. Lectures on constructive functional programming. In M. Broy, editor, Constructive Methods in Computing Science, volume F55 of NATO ASI Series, pages 151–216. Springer-Verlag, 1989.

    Google Scholar 

  2. M.M. Fokkinga. Monadic maps and folds for arbitrary datatypes. Memoranda Informatica 94–28, University of Twente, June 1994.

    Google Scholar 

  3. P. Freyd. Recursive types reduced to inductive types. In Proceedings Logic in Computer Science LICS90, pages 498–507, 1990.

    Google Scholar 

  4. A. Gill, J. Launchbury, and S.L. Peyton Jones. A short cut to deforestation. In Proceedings Functional Programming Languages and Computer Architecture FPCA93, pages 223–232, 1993.

    Google Scholar 

  5. J. Jeuring. Algorithms from theorems. In M. Broy and C.B. Jones, editors, Programming Concepts and Methods, pages 247–266. North-Holland, 1990.

    Google Scholar 

  6. Thomas Johnsson. Fold-Unfold Transformations on State Monadic Interpreters. In Proceedings of the Glasgow Functional Programming Workshop, Ayr 1994, Workshops in Computing. Springer Verlag, 1995. (To appear).

    Google Scholar 

  7. Mark P. Jones. Release notes for Gofer 2.28. Included as part of the standard Gofer distribution, February 1993.

    Google Scholar 

  8. R.B. Kieburtz and J. Lewis. Programming with algebras. In J. Jeuring and E. Meijer, editors, Lecture Notes on Advanced Functional Programming Techniques, LNCS. Springer-Verlag, 1995.

    Google Scholar 

  9. J. Launchbury. Lazy imperative programming. In Proceedings ACM Sigplan Workshop on State in Programming Languages, 1993. YALEU/DCS/RR-968, Yale University.

    Google Scholar 

  10. J. Launchbury. Graph algorithms with a functional flavour. In J. Jeuring and E. Meijer, editors, Lecture Notes on Advanced Functional Programming Techniques, LNCS. Springer-Verlag, 1995.

    Google Scholar 

  11. G. Malcolm. Data structures and program transformation. Science of Computer Programming, 14:255–279, 1990.

    Article  Google Scholar 

  12. L. Meertens. Algorithmics—towards programming as a mathematical activity. In J.W. de Bakker, M. Hazewinkel, and J.K. Lenstra, editors, Proceedings of the CWI Symposium on Mathematics and Computer Science, volume 1 of CWI Monographs, pages 289–334. North-Holland, 1986.

    Google Scholar 

  13. E. Meijer, M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes, and barbed wire. In J. Hughes, editor, Proceedings of the 5th ACM Conference on Functional Programming Languages and Computer Architecture FPCA91, Cambridge, Massachusetts, pages 124–144, 1991.

    Google Scholar 

  14. E. Meijer and G. Hutton. Bananas in space: Extending fold and unfold to exponential types. In S. Peyton Jones, editor, Proceedings Functional Programming Languages and Computer Architecture FPCA95, 1995.

    Google Scholar 

  15. E. Moggi. Notions of computation and monads. Information and Computation, 93(1):55–92, 1991.

    Google Scholar 

  16. R. Paterson. Control structures from types. rap@doc.ic.ac.uk, 1994.

    Google Scholar 

  17. R. Paterson. Notes on computational monads. rap@doc.ic.ac.uk, 1995.

    Google Scholar 

  18. G.N. Franz P.B. Brown and H. Moraff. Electronics for the Modern Scientist. Elsevier Science Publishing Co., Inc., 1982.

    Google Scholar 

  19. S.D. Swierstra and O. de Moor. Virtual datastructures. In Helmut Partsch Berhard Möller and Steve Schuman, editors, Formal Program Development, LNCS 755, pages 355–371. Springer-Verlag, 1993.

    Google Scholar 

  20. R. Sethi. Programming Languages: Concepts and Structures. Addison-Wesley, 1989.

    Google Scholar 

  21. W. Strunk Jr. and E.B. White. The Elements of Style. MacMillan Publishing Co., Inc., 1979. Third Edition.

    Google Scholar 

  22. A. Takano and E. Meijer. Shortcut deforestation in calculational form. In S. Peyton Jones, editor, Proceedings Functional Programming Languages and Computer Architecture FPCA95, 1995.

    Google Scholar 

  23. P. Wadler. Deforestation: transforming programs to eliminate trees. In Proceedings European Sytmposium on Programming, ESOP88, pages 344–358. Springer-Verlag, 1988. LNCS 300.

    Google Scholar 

  24. P. Wadler. Theorems for free! In Proceedings Functional Programming Languages and Computer Architecture FPCA89, Imperial College, London, pages 347–359. ACM Press, 1989.

    Google Scholar 

  25. P. Wadler. Comprehending monads. In Proceedings 1990 ACM Conference on Lisp and Functional Programming, pages 61–78, 1990.

    Google Scholar 

  26. P. Wadler. Monads for functional programming. In J. Jeuring and E. Meijer, editors, Lecture Notes on Advanced Functional Programming Techniques, LNCS. Springer-Verlag, 1995.

    Google Scholar 

  27. J. van der Woude and L. Meertens. A tribute to attributes. The Squiggolist, 2(1):20–26, 1991.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Johan Jeuring Erik Meijer

Rights and permissions

Reprints and permissions

Copyright information

© 1995 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Meijer, E., Jeuring, J. (1995). Merging monads and folds for functional programming. In: Jeuring, J., Meijer, E. (eds) Advanced Functional Programming. AFP 1995. Lecture Notes in Computer Science, vol 925. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-59451-5_7

Download citation

  • DOI: https://doi.org/10.1007/3-540-59451-5_7

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-59451-2

  • Online ISBN: 978-3-540-49270-2

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics