Skip to main content
×
Home

Comprehending monads

  • Philip Wadler (a1)
Abstract

Category theorists invented monads in the 1960's to express concisely certain aspects of universal algebra. Functional programmers invented list comprehensions in the 1970's to express concisely certain programs involving lists. This paper shows how list comprehensions may be generalised to an arbitrary monad, and how the resulting programming feature can express concisely in a pure functional language some programs that manipulate state, handle exceptions, parse text, or invoke continuations. A new solution to the old problem of destructive array update is also presented. No knowledge of category theory is assumed.

Copyright
References
Hide All
Appel A. and Jim T. (1989) Continuation-passing, closure-passing style. In: 16th ACM Symposium on Principles of Programming Languages, Austin, Texas.
Barr M. and Wells C. (1985) Toposes, Triples, and Theories. Springer Verlag.
Bird R. and Wadler P. (1988) Introduction to Functional Programming. Prentice Hall.
Bloss A. (1989) Update analysis and the efficient implementation of functional aggregates. In: 4th Symposium on Functional Programming Languages and Computer Architecture, ACM, London.
Fairbairn J. (1987) Form follows function. Software — Practice and Experience, 17(6) 379386.
Gifford D. K. and Lucassen J. M. (1986) Integrating functional and imperative programming. In: ACM Conference on Lisp and Functional Programming. Cambridge, Massachusetts, 2839.
Goguen J. A. (1988) Higher order functions considered unnecessary for higher order programming. Technical report SRI-CSL-88–1, SRI International.
Gordon M.Milner R. and Wadsworth C. (1979) Ediburgh LCF. LNCS 78, Springer-Verlag.
Guzmán J. and Hudak P. (1990) Single-threaded polymorphic lambda calculus. In: IEEE Symposium on Logic in Computer Science, Philadelphia.
Harper R., Milner R. and Tofte M. (1988) The definition of Standard ML, version 2. Report ECS-LFCS-88–62, Edinburgh Uiversity, Dept. of Computer Science.
Holmström S. (1983) A simple and efficient way to handle large data structures in applicative languages. In: Proceedings SERC/Chalmers Workshop on Declarative Programming, University College London.
Hudak P. (1986a) A semantic model of reference counting and its abstraction (detailed summary). In: ACM Conference on Lisp and Functional Programming, Cambridge, Massachusetts, 351363.
Hudak P. (1986) Arrays, non-determinism, side-effects, and parallelism: a functional perspective. In: Fasel J. H. and Keller R. M., editors, Workshop o Graph Reduction, Santa Fe, New Mexico, LNCS 279, Springer-Verlag.
Hudak P., Peyton Jones S. and Wadler P., editors, (1991) Report on the Programming Language Haskell: Version 1.1. Technical report, Yale University and Glasgow University.
Hughes J. (1989) Why functional programming matters. The Computer Journal, 32(2) 98107.
Hughes J. and O'Donnell J. (1989) Expressing and reasoing about non-deterministic functional programs. In: Davis K. and Hughes J., editors, Functional Programming, Glasgow 1989 (Glasgow workshop, Fraserburgh, August), Workshops in Computing, Springer Verlag.
Lambek J. and Scott P. (1986) Introduction to Higher Order Categorical Logic. Cambridge University Press.
Mac Lane S. (1971) Categories for the Working Mathematician. Springer-Verlag.
Mason I. and Talcott C. (1989) Axiomatising operational equivalence in the presence of side effects. In: IEEE Symposium on Logic in Computer Science, Asilomar, California.
Milner R. (1984) A proposal for Standard ML. In: ACM Symposium on Lisp and Functional Programming, Austin, Texas.
Moggi E. (1989a) Computational lambda-calculus and monads. In: IEEE Symposium on Logic in Computer Science, Asilomar, California. (A longer version is available as a technical report from the University of Edinburgh.)
Moggi E. (1989b) An abstract view of programming languages. Course notes, University of Edinburgh.
Plotkin G. (1975) Call-by-name, call-by-value, and the λ-calculus. Theoretical Computer Science, 1 125159.
Rees J. and Clinger W., editors, (1986) The revised3 report on the algorithmic language Scheme. ACM SIGPLAn Notices, 21(12) 3779.
Reynolds J. C. (1974) On the relation between direct and continuation semantics. In: Colloquium on Automata, Languages and Programming, Saarbrücken, LNCS 14, Springer-Verlag.
Reynolds J. C. (1983) Types, abstraction, and parametric polymorphism. In: Mason R. E. A., editor, Information Processing 83, North-Holland, Amsterdam, 513523.
Schmidt D. A. (1985) Detecting global variables in denotational specifications. ACM Transactions on Programming Languages and Systems, 7 299310.
Spivey M. (1990) A functional theory of exceptions. Science of Computer Programming. 14(1) 2542.
Turner D. A. (1982) Recursion equations as a programming language. In: Darlington J., Henderson P., and Turner D. A., editors, Functional Programming and its Applications, Cambridge, University Press.
Turner D. A. (1985) Miranda: A non-strict functional language with polymorphic types. In: Proceedings of the 2nd International Conference on Functional Programming Languages and Computer Architecture, Nancy, France, LNCS 201, Springer Verlag.
Wadler P. (1985) How to replace failure by a list of successes. In: 2nd Symposium on Functional Programming Languages and Computer Architecture, Nancy, LNCS 273, Springer-Verlag.
Wadler P. (1987) List comprehensions. In: Jones S. L. Peyton, The Implementation of Functional Programming Languages, Prentice Hall.
Wadler P. (1989) Theorems for free! In: 4th Symposium of Functional Programming Languages and Computer Architecture, ACM, London.
Wadler P. (1990a) Linear types can change the world! In: Broy M. and Jones C., editors, Programming Concepts and Methods (IFIP Working Conference, Sea of Gallilee, Israel, April), North Halland.
Wadler P. (1990b) Comprehending monads. In: ACM Conference on Lisp and Functional Programming, Nice.
Wadler P. (1991) Is there a use for linear logic? In: Conference on Partial Evaluation and Semantics-Baed Program Manipulation (PEPM), ACM, New Haven, Connecticut.
Wadler P. (1992) The essence of functional programming. In: Proceedings of the 19th Annual Symposium on Principles of Programming Languages, Albuquerque, N.M.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Mathematical Structures in Computer Science
  • ISSN: 0960-1295
  • EISSN: 1469-8072
  • URL: /core/journals/mathematical-structures-in-computer-science
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×