## Comprehending Monads (1990)

### Cached

### Download Links

- [isabase.philol.msu.ru]
- [www-sop.inria.fr]
- [www.swiss.ai.mit.edu:8000]
- [ftp.dcs.glasgow.ac.uk]
- [pag.lcs.mit.edu]
- [pag.csail.mit.edu]
- DBLP

### Other Repositories/Bibliography

Venue: | Mathematical Structures in Computer Science |

Citations: | 467 - 14 self |

### BibTeX

@INPROCEEDINGS{Wadler90comprehendingmonads,

author = {Philip Wadler},

title = {Comprehending Monads},

booktitle = {Mathematical Structures in Computer Science},

year = {1990},

pages = {61--78}

}

### Years of Citing Articles

### OpenURL

### Abstract

Category theorists invented monads in the 1960’s to concisely express certain aspects of universal algebra. Functional programmers invented list comprehensions in the 1970’s to concisely express certain programs involving lists. This paper shows how list comprehensions may be generalised to an arbitrary monad, and how the resulting programming feature can concisely express 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. 1

### Citations

1624 | The Definition of Standard ML - Milner, Tofte, et al. - 1990 |

1354 | Introduction to Functional Programming - Bird - 1998 |

984 | Categories for the Working Mathematician - Lane - 1997 |

560 |
The Implementation of Functional Programming Languages
- Jones
- 1987
(Show Context)
Citation Context ...is assumed. The paper contains two significant new contributions. The first contribution is a new language feature, the monad comprehension. This generalises the familiar notion of list comprehension =-=[Wad87]-=-, due originally to Burstall and Darlington, and found in KRC [Tur82], Miranda, Haskell and other languages. Monad comprehensions are not essential to the structuring technique described here, but the... |

457 | Computational Lambda-calculus and monads
- Moggi
- 1988
(Show Context)
Citation Context ...such structure only when it is needed. It is needed here, as evidenced by Moggi's requirement that a computational monad have a strength, a function t :: (x ; M y) ! M (x ; y) satisfying certain laws =-=[Mog89a]-=-. In a cartesian closed category, a monad with a strength is equivalent to a monad with a strong functor as described above. In our framework, the strength is defined by t (x ; y) = [ (x ; y) j y / y ... |

449 | Introduction to Higher Order Categorical Logic - Lambek, Scott - 1986 |

419 | Category Theory for Computer Science - Barr, Wells - 1990 |

381 |
Types, abstraction and parametric polymorphism
- Reynolds
- 1983
(Show Context)
Citation Context ...rphic types of unit and join. The idea of deriving laws from types goes by the slogan "theorems for free" [Wad89] and is a consequence of Reynolds' abstraction theorem for polymorphic lambda=-= calculus [Rey83]-=-. In categorical terms, unit and join are natural transformations. Rather than treat unit as a single function with a polymorphic type, categorists treat it as a family of arrows, unit x :: x !M x , o... |

339 | Theorems for free
- Wadler
- 1989
(Show Context)
Citation Context ...map (map f ): Laws (iii ) and (iv) may be derived by a systematic transformation of the polymorphic types of unit and join. The idea of deriving laws from types goes by the slogan "theorems for f=-=ree" [Wad89]-=- and is a consequence of Reynolds' abstraction theorem for polymorphic lambda calculus [Rey83]. In categorical terms, unit and join are natural transformations. Rather than treat unit as a single func... |

299 | Why functional programming matters - Hughes - 1989 |

221 | Call-by-name, call-by-value and the -calculus - Plotkin - 1975 |

221 | An introduction to the theory of lists - Bird - 1987 |

215 | Call-by-name, call-by-value and the λ-calculus - Plotkin - 1975 |

153 |
Miranda: A non-strict functional language with polymorphic types
- Turner
- 1985
(Show Context)
Citation Context ...and Scheme [RC86] support a wide variety of features, such as assigning to state, handling exceptions, and invoking continuations. Pure, lazy functional languages such as Haskell [HPW91] or Miranda 1 =-=[Tur85]-=- eschew such features, because they are incompatible with the advantages of lazy evaluation and equational reasoning, advantages that have been described at length elsewhere [Hug89, BW88]. Purity has ... |

139 | Linear types can change the world
- Wadler
- 1990
(Show Context)
Citation Context ...ers in an SR-comprehension is irrelevant, and so it is perfectly permissible to evaluate e 1 and e 2 in any order, or even concurrently. The interpreter derived here is similar in structure to one in =-=[Wad90], which us-=-es a type system based on linear logic to guarantee safe destructive update of arrays. (Related type systems are discussed in [GH90, Wad91].) However, the linear type system uses a "let!" co... |

112 | Continuation-passing, closure-passing style - Appel, Jim - 1989 |

96 | Algorithmics — towards programming as a mathematical activity - Meertens - 1986 |

92 | Is there a use for linear logic - Wadler - 1991 |

91 |
How to replace failure by a list of successes
- Wadler
(Show Context)
Citation Context ...r operators appear in other languages. As an example of its use, the term the ([ x \Gamma 1 j xs1 ] Maybe ? [ 0 ] Maybe ) 22 returns the predecessor of x if it is non-negative, and zero otherwise. In =-=[Wad85]-=- it was proposed to use lists to represent exceptions, encoding a value x by the unit list, and an exception by the empty list. This corresponds to the mapping list :: Maybe x ! List x list (Just x ) ... |

90 |
Integrating functional and imperative programming
- Gifford, Lucassen
- 1986
(Show Context)
Citation Context .... A key feature of the monad approach is the use of types to indicate what parts of a program may have what sorts of effects. In this, it is similar in spirit to Gifford and Lucassen's effect systems =-=[GL88]-=-. The examples in this paper are based on Haskell [HPW91], though any lazy functional language incorporating the Hindley/Milner type system would work as well. The remainder of this paper is organised... |

73 | Single-threaded polymorphic lambda calculus - Guzmán, Hudak - 1990 |

63 |
Wadler (editors). Report on the programming language Haskell – a non-strict purely functional language, version 1.2
- Hudak, Jones, et al.
- 1992
(Show Context)
Citation Context ...rd ML [Mil84, HMT88] and Scheme [RC86] support a wide variety of features, such as assigning to state, handling exceptions, and invoking continuations. Pure, lazy functional languages such as Haskell =-=[HPW91]-=- or Miranda 1 [Tur85] eschew such features, because they are incompatible with the advantages of lazy evaluation and equational reasoning, advantages that have been described at length elsewhere [Hug8... |

58 |
Detecting global variables in denotational specifications. ACM transactions on programming languages and systems
- Schmidt
- 1985
(Show Context)
Citation Context ... this solution has never been proposed before, and its discovery comes as a surprise considering the plethora of more elaborate solutions that have been proposed: these include syntactic restrictions =-=[Sch85]-=-, run-time checks [Hol83], abstract interpretation [Hud86a, Hud86b, Blo89], and exotic type systems [GH90, Wad90, Wad91]. That monads led to the discovery of this solution must count as a point in the... |

49 | On the relation between direct and continuation semantics, Automata, languages and programming - Reynolds - 1974 |

41 |
A functional theory of exceptions
- Spivey
- 1990
(Show Context)
Citation Context ...some previous proposals for incorporating various features into functional languages: exceptions [Wad85, Spi90], parsers [Wad85, Fai87, FL89], and non-determinism [HO89]. In particular, Spivey's work =-=[Spi90]-=- is notable for pointing out, independently of Moggi, that monads provide a frame2 work for exception handling. There is a translation scheme from -calculus into an arbitrary monad. Indeed, there are ... |

35 | The definition of Standard ML (version 2 - Harper, Milner, et al. - 1988 |

35 |
Recursion equations as a programming language
- Turner
- 1982
(Show Context)
Citation Context ... first contribution is a new language feature, the monad comprehension. This generalises the familiar notion of list comprehension [Wad87], due originally to Burstall and Darlington, and found in KRC =-=[Tur82]-=-, Miranda, Haskell and other languages. Monad comprehensions are not essential to the structuring technique described here, but they do provide a pleasant syntax for expressing programs structured in ... |

33 |
Expressing and reasoning about nondeterministic functional programs
- Hughes, O’Donnell
- 1990
(Show Context)
Citation Context ...rehensions help to clarify and unify some previous proposals for incorporating various features into functional languages: exceptions [Wad85, Spi90], parsers [Wad85, Fai87, FL89], and non-determinism =-=[HO89]-=-. In particular, Spivey's work [Spi90] is notable for pointing out, independently of Moggi, that monads provide a frame2 work for exception handling. There is a translation scheme from -calculus into ... |

31 | Update analysis and the efficient implementation of functional aggregates - Bloss - 1989 |

29 | A Semantic Model of Reference Counting and its Abstraction (Detailed Summary - Hudak - 1986 |

25 | Constructing natural language interpreters in a lazy functional language - Frost, Launchbury - 1989 |

17 | A categorical approach to the theory of lists - Spivey - 1989 |

8 | Higher order functions considered unnecessary for higher order programming
- Goguen
- 1988
(Show Context)
Citation Context ...ture of the solution means that it cannot be applied in first-order languages such as Prolog or OBJ. It also casts doubt on Goguen's thesis that first-order languages are sufficient for most purposes =-=[Gog88]-=-. Monads and monad comprehensions help to clarify and unify some previous proposals for incorporating various features into functional languages: exceptions [Wad85, Spi90], parsers [Wad85, Fai87, FL89... |

5 | non-determinism, side-effects, and parallelism: A functional perspective - Arrays - 1986 |

5 | Report on the functional programming language - Hudak, Wadler - 1988 |

3 | Form follows function - Fairbairn - 1987 |

3 |
A simple and efficient way to handle large data structures in applicative languges
- Holmstrom
- 1983
(Show Context)
Citation Context ...been proposed before, and its discovery comes as a surprise considering the plethora of more elaborate solutions that have been proposed: these include syntactic restrictions [Sch85], run-time checks =-=[Hol83]-=-, abstract interpretation [Hud86a, Hud86b, Blo89], and exotic type systems [GH90, Wad90, Wad91]. That monads led to the discovery of this solution must count as a point in their favour. Why has this s... |

3 | An abstract view of programming languges. Course notes - Moggi |

2 |
Axiomatising operational equivalence in the presence of side effects
- Mason, Talcott
- 1989
(Show Context)
Citation Context ...ctly the order in which the assignments take effect, regardless of the order of evaluation used. Reasoning about programs in impure functional languages is problematic (although not impossible -- see =-=[MT89]-=- for one approach). In contrast, programs written using monads, like all pure programs, can be reasoned about in the usual way, substituting equals for equals. They also satisfy additional laws, such ... |