Abstract
The use of monads to structure functional programs is described. Monads provide a convenient framework for simulating effects found in other languages, such as global state, exception handling, output, or non-determinism. Three case studies are looked at in detail: how monads ease the modification of a simple evaluator; how monads act as the basis of a datatype of arrays subject to in-place update; and how monads can be used to build parsers.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
S. Abramsky and C. Hankin, Abstract Interpretation of Declarative Languages, Ellis Horwood, 1987.
A. Bloss, Update analysis and the efficient implementation of functional aggregates. In 4 ’th Symposium on Functional Programming Languages and Computer Architecture, ACM, London, September 1989.
R. Bird and P. Wadler, Introduction to Functional Programming. Prentice Hall, 1987.
P. Hudak, S. Peyton Jones and P. Wadler, editors, Report on the Programming Language Haskell: Version 1.1. Technical report, Yale University and Glasgow University, August 1991.
J.-Y. Girard, Linear logic. Theoretical Computer Science, 50: 1–102, 1987.
J. Guzman and P. Hudak, Single-threaded polymorphic lambda calculus. In IEEE Symposium on Logic in Computer Science, Philadelphia, June 1990.
P. Hudak, A semantic model of reference counting and its abstraction (detailed summary). In ACM Conference on Lisp and Functional Programming, pp. 351–363, Cambridge, Massachusetts, August 1986.
P. Hudak, Continuation-based mutable abstract data types, or how to have your state and munge it too. Technical report YALEU/DCS/RR914, Department of Computer Science, Yale University, July 1992.
D. King and P. Wadler, Combining monads. In H.J. Launchbury, P. Sanson (eds.), Functional Programming, Glasgow 1992, Workshop Proceedings, pp. 134–143, Workshops in Computing, Springer-Verlag 1993.
S. Mac Lane, Categories for the Working Mathematician, Springer-Verlag, 1971.
R. Milner, M. Tofte, and R. Harper, The definition of Standard ML. MIT Press, 1990.
L. C. Paulson, ML for the Working Programmer. Cambridge University Press, 1991.
E. Moggi, Computational lambda-calculus and monads. In Symposium on Logic in Computer Science, Asilomar, California; IEEE, June 1989. (A longer version is available as a technical report from the University of Edinburgh.)
E. Moggi, An abstract view of programming languges. Course notes, University of Edinburgh.
S. L. Peyton Jones and P. Wadler, Imperative functional programming. In 20’th Symposium on Principles of Programming Languages, Charleston, South Carolina; ACM, January 1993.
G. Plotkin, Call-by-name, call-by-value, and the a-calculus. Theoretical Computer Science, 1: 125–159, 1975.
J. Rees and W. Clinger (eds.), The revised’ report on the algorithmic language Scheme. ACM SIGPLAN Notices, 21(12):37–79, 1986.
D. Schmidt, Detecting global variables in denotational specifications. ACM Trans. on Programming Languages and Systems, 7:299–310, 1985.
V. Swarup, U. S. Reddy, and E. Ireland, Assignments for applicative languages. In Conference on Functional Programming Languages and Computer Architecture, Cambridge, Massachusetts; LNCS 523, Springer Verlag, August 1991.
D. A. Turner, An overview of Miranda. In D. A. Turner, editor, Research Topics in Functional Programming. Addison Wesley, 1990.
P. Wadler, Comprehending monads. In Conference on Lisp and Functional Programming, Nice, France; ACM, June 1990.
Is there a use for linear logic? Conference on Partial Evaluation and Semantics-Based Program Manipulation (PEPM), New Haven, Connecticut; ACM, June 1991.
P. Wadler, The essence of functional programming (invited talk). In 19’th Symposium on Principles of Programming Languages, Albuquerque, New Mexico; ACM, January 1992.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1993 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Wadler, P. (1993). Monads for functional programming. In: Broy, M. (eds) Program Design Calculi. NATO ASI Series, vol 118. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-02880-3_8
Download citation
DOI: https://doi.org/10.1007/978-3-662-02880-3_8
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-08164-4
Online ISBN: 978-3-662-02880-3
eBook Packages: Springer Book Archive