the essence of functional programming

I've transcripted the code examples from the paper "The essence of functional programming" by Philip Wadler.

Invited talk, 19'th Symposium on Principles of Programming Languages,
ACM Press, Albuquerque, January 1992.
http://homepages.inf.ed.ac.uk/wadler/papers/essence/essence.ps

http://homepages.inf.ed.ac.uk/wadler/topics/monads.html

This paper explores the use monads to structure functional programs. No prior knowledge of monads or category theory is required.

Monads increase the ease with which programs may be modified. They can mimic the effect of impure features such as exceptions, state, and continuations; and also provide effects not easily achieved with such features. The types of a program reflect which effects occur.

The first section is an extended example of the use of monads. A simple interpreter is modified to support various extra features: error messages, state, output, and non-deterministic choice. The second section describes the relation between monads and continuation-passing style. The third section sketches how monads are used in a compiler for Haskell that is written in Haskell.

Download the code examples.

Review of the paper in Russian.

Categories:

Updated: