Skip to main content

Monads for functional programming

  • Conference paper
  • First Online:

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

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.

A previous version of this note appeared in: M. Broy, editor, Program Design Calculi, Proceedings of the Marktoberdorf Summer School, 30 July–8 August 1992.

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

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. S. Abramsky and C. Hankin, Abstract Interpretation of Declarative Languages, Ellis Horwood, 1987.

    Google Scholar 

  2. 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.

    Google Scholar 

  3. R. Bird and P. Wadler, Introduction to Functional Programming. Prentice Hall, 1987.

    Google Scholar 

  4. 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.

    Google Scholar 

  5. J.-Y. Girard, Linear logic. Theoretical Computer Science, 50:1–102, 1987.

    Article  Google Scholar 

  6. J. Guzmán and P. Hudak, Single-threaded polymorphic lambda calculus. In IEEE Symposium on Logic in Computer Science, Philadelphia, June 1990.

    Google Scholar 

  7. 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.

    Google Scholar 

  8. P. Hudak, Continuation-based mutable abstract data types, or how to have your state and munge it too. Technical report YALEU/DCS/RR-914, Department of Computer Science, Yale University, July 1992.

    Google Scholar 

  9. D. King and P. Wadler, Combining monads. In Glasgow Workshop on Functional Programming, Ayr, July 1992. Workshops in Computing Series, Springer Verlag, to appear.

    Google Scholar 

  10. S. Mac Lane, Categories for the Working Mathematician, Springer-Verlag, 1971.

    Google Scholar 

  11. R. Milner, M. Tofte, and R. Harper, The definition of Standard ML. MIT Press, 1990.

    Google Scholar 

  12. 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.)

    Google Scholar 

  13. E. Moggi, An abstract view of programming languges. Course notes, University of Edinburgh.

    Google Scholar 

  14. L. C. Paulson, ML for the Working Programmer. Cambridge University Press, 1991.

    Google Scholar 

  15. 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.

    Google Scholar 

  16. G. Plotkin, Call-by-name, call-by-value, and the λ-calculus. Theoretical Computer Science, 1:125–159, 1975.

    Article  Google Scholar 

  17. J. Rees and W. Clinger (eds.), The revised 3 report on the algorithmic language Scheme. ACM SIGPLAN Notices, 21(12):37–79, 1986.

    Google Scholar 

  18. D. Schmidt, Detecting global variables in denotational specifications. ACM Trans. on Programming Languages and Systems, 7:299–310, 1985.

    Google Scholar 

  19. 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.

    Google Scholar 

  20. D. A. Turner, An overview of Miranda. In D. A. Turner, editor, Research Topics in Functional Programming. Addison Wesley, 1990.

    Google Scholar 

  21. P. Wadler, Comprehending monads. In Conference on Lisp and Functional Programming, Nice, France; ACM, June 1990.

    Google Scholar 

  22. P.Wadler, Is there a use for linear logic? Conference on Partial Evaluation and Semantics-Based Program Manipulation (PEPM), New Haven, Connecticut; ACM, June 1991.

    Google Scholar 

  23. P. Wadler, The essence of functional programming (invited talk). In 19'th Symposium on Principles of Programming Languages, Albuquerque, New Mexico; ACM, January 1992.

    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

Wadler, P. (1995). Monads 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_2

Download citation

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

  • 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