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.
Preview
Unable to display preview. Download preview PDF.
References
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.
M.M. Fokkinga. Monadic maps and folds for arbitrary datatypes. Memoranda Informatica 94–28, University of Twente, June 1994.
P. Freyd. Recursive types reduced to inductive types. In Proceedings Logic in Computer Science LICS90, pages 498–507, 1990.
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.
J. Jeuring. Algorithms from theorems. In M. Broy and C.B. Jones, editors, Programming Concepts and Methods, pages 247–266. North-Holland, 1990.
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).
Mark P. Jones. Release notes for Gofer 2.28. Included as part of the standard Gofer distribution, February 1993.
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.
J. Launchbury. Lazy imperative programming. In Proceedings ACM Sigplan Workshop on State in Programming Languages, 1993. YALEU/DCS/RR-968, Yale University.
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.
G. Malcolm. Data structures and program transformation. Science of Computer Programming, 14:255–279, 1990.
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.
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.
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.
E. Moggi. Notions of computation and monads. Information and Computation, 93(1):55–92, 1991.
R. Paterson. Control structures from types. rap@doc.ic.ac.uk, 1994.
R. Paterson. Notes on computational monads. rap@doc.ic.ac.uk, 1995.
G.N. Franz P.B. Brown and H. Moraff. Electronics for the Modern Scientist. Elsevier Science Publishing Co., Inc., 1982.
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.
R. Sethi. Programming Languages: Concepts and Structures. Addison-Wesley, 1989.
W. Strunk Jr. and E.B. White. The Elements of Style. MacMillan Publishing Co., Inc., 1979. Third Edition.
A. Takano and E. Meijer. Shortcut deforestation in calculational form. In S. Peyton Jones, editor, Proceedings Functional Programming Languages and Computer Architecture FPCA95, 1995.
P. Wadler. Deforestation: transforming programs to eliminate trees. In Proceedings European Sytmposium on Programming, ESOP88, pages 344–358. Springer-Verlag, 1988. LNCS 300.
P. Wadler. Theorems for free! In Proceedings Functional Programming Languages and Computer Architecture FPCA89, Imperial College, London, pages 347–359. ACM Press, 1989.
P. Wadler. Comprehending monads. In Proceedings 1990 ACM Conference on Lisp and Functional Programming, pages 61–78, 1990.
P. Wadler. Monads for functional programming. In J. Jeuring and E. Meijer, editors, Lecture Notes on Advanced Functional Programming Techniques, LNCS. Springer-Verlag, 1995.
J. van der Woude and L. Meertens. A tribute to attributes. The Squiggolist, 2(1):20–26, 1991.
Author information
Authors and Affiliations
Editor information
Rights 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