Monads for functional programming

  • Philip Wadler
Conference paper
Part of the Lecture Notes in Computer Science book series (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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    S. Abramsky and C. Hankin, Abstract Interpretation of Declarative Languages, Ellis Horwood, 1987.Google Scholar
  2. 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. 3.
    R. Bird and P. Wadler, Introduction to Functional Programming. Prentice Hall, 1987.Google Scholar
  4. 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. 5.
    J.-Y. Girard, Linear logic. Theoretical Computer Science, 50:1–102, 1987.CrossRefGoogle Scholar
  6. 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. 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. 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. 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. 10.
    S. Mac Lane, Categories for the Working Mathematician, Springer-Verlag, 1971.Google Scholar
  11. 11.
    R. Milner, M. Tofte, and R. Harper, The definition of Standard ML. MIT Press, 1990.Google Scholar
  12. 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. 13.
    E. Moggi, An abstract view of programming languges. Course notes, University of Edinburgh.Google Scholar
  14. 14.
    L. C. Paulson, ML for the Working Programmer. Cambridge University Press, 1991.Google Scholar
  15. 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. 16.
    G. Plotkin, Call-by-name, call-by-value, and the λ-calculus. Theoretical Computer Science, 1:125–159, 1975.CrossRefGoogle Scholar
  17. 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. 18.
    D. Schmidt, Detecting global variables in denotational specifications. ACM Trans. on Programming Languages and Systems, 7:299–310, 1985.Google Scholar
  19. 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. 20.
    D. A. Turner, An overview of Miranda. In D. A. Turner, editor, Research Topics in Functional Programming. Addison Wesley, 1990.Google Scholar
  21. 21.
    P. Wadler, Comprehending monads. In Conference on Lisp and Functional Programming, Nice, France; ACM, June 1990.Google Scholar
  22. 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. 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

Copyright information

© Springer-Verlag 1995

Authors and Affiliations

  • Philip Wadler
    • 1
  1. 1.Department of Computing ScienceUniversity of GlasgowScotland

Personalised recommendations