The essence of functional programming (Invited talk)

The essence of functional programming (Invited talk)

1992 | Philip Wadler
This paper explores the use of monads to structure functional programs, emphasizing their ability to enhance modularity and ease of modification. Monads can mimic impure features such as exceptions, state, and continuations, and provide effects not easily achieved with these features. The types of a program reflect which effects occur. The first section presents an extended example of using monads to modify a simple interpreter to support various features: error messages, state, output, and non-deterministic choice. The second section discusses the relationship between monads and continuation-passing style (CPS), showing that CPS arises as a special case of a monad and can be embedded in CPS by changing the answer type. The third section sketches how monads are used in a compiler for Haskell, which is written in Haskell itself. The paper concludes by highlighting the benefits of monads in enhancing modularity and the potential for further exploration in areas such as efficiency, combining monads, and their comparison to other approaches to state. The author also reflects on the origins of these ideas, tracing them back to category theory and the work of Eugenio Moggi and Michael Spivey.This paper explores the use of monads to structure functional programs, emphasizing their ability to enhance modularity and ease of modification. Monads can mimic impure features such as exceptions, state, and continuations, and provide effects not easily achieved with these features. The types of a program reflect which effects occur. The first section presents an extended example of using monads to modify a simple interpreter to support various features: error messages, state, output, and non-deterministic choice. The second section discusses the relationship between monads and continuation-passing style (CPS), showing that CPS arises as a special case of a monad and can be embedded in CPS by changing the answer type. The third section sketches how monads are used in a compiler for Haskell, which is written in Haskell itself. The paper concludes by highlighting the benefits of monads in enhancing modularity and the potential for further exploration in areas such as efficiency, combining monads, and their comparison to other approaches to state. The author also reflects on the origins of these ideas, tracing them back to category theory and the work of Eugenio Moggi and Michael Spivey.
Reach us at info@study.space
[slides] The essence of functional programming | StudySpace