The essence of functional programming

This paper explores the use monads to structure functionalprograms. No prior knowledge of monads or category theory isrequired. 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 easilyachieved with such features. The types of a program reflect whicheffects occur. The first section is an extended example of the use of monads. Asimple interpreter is modified to support various extra features:error messages, state, output, and non-deterministic choice. Thesecond section describes the relation between monads and thecontinuation-passing style. The third section sketches how monadsare used in a compiler for Haskell that is written in Haskell.

[1]  J. Michael Spivey,et al.  A Functional Theory of Exceptions , 1990, Sci. Comput. Program..

[2]  Gerald Jay Sussman,et al.  Lambda: The Ultimate Imperative , 1976 .

[3]  Philip Wadler,et al.  Comprehending monads , 1990, Mathematical Structures in Computer Science.

[4]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[5]  David Turner An overview of Miranda 1 , 1990 .

[6]  Richard S. Bird,et al.  Introduction to functional programming , 1988, Prentice Hall International series in computer science.

[7]  Olivier Danvy,et al.  Abstracting control , 1990, LISP and Functional Programming.

[8]  S. Lane Categories for the Working Mathematician , 1971 .

[9]  Vipin Swarup,et al.  Assignments for Applicative Languages , 1991, FPCA.

[10]  John C. Reynolds,et al.  The Coherence of Languages with Intersection Types , 1991, TACS.

[11]  Paul Hudak,et al.  Single-threaded polymorphic lambda calculus , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[12]  Eugenio Moggi,et al.  Computational lambda-calculus and monads , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[13]  J. Lambek,et al.  Introduction to higher order categorical logic , 1986 .

[14]  John C. Reynolds,et al.  Using category theory to design implicit conversions and generic operators , 1980, Semantics-Directed Compiler Generation.

[15]  John C. Reynolds,et al.  Preliminary design of the programming language Forsythe , 1988 .

[16]  Philip Wadler,et al.  Packrat parsing:: simple, powerful, lazy, linear time, functional pearl , 2002, ICFP '02.

[17]  Philip Wadler,et al.  Is there a use for linear logic? , 1991, PEPM '91.

[18]  David K. Gifford,et al.  Integrating functional and imperative programming , 1986, LFP '86.

[19]  David Turner An overview of Miranda , 1986, SIGP.

[20]  Philip Wadler Is there a use for linear logic , 1991 .

[21]  John C. Reynolds,et al.  Syntactic Control of Inference, Part 2 , 1989, ICALP.

[22]  Robert Harper,et al.  Typing first-class continuations in ML , 1991, POPL '91.

[23]  WadlerPhilip,et al.  Report on the programming language Haskell , 1992 .

[24]  Simon Peyton Jones,et al.  The Implementation of Functional Programming Languages (Prentice-hall International Series in Computer Science) , 1987 .

[25]  Gordon D. Plotkin,et al.  Call-by-Name, Call-by-Value and the lambda-Calculus , 1975, Theor. Comput. Sci..

[26]  Pierre Jouvelot,et al.  Algebraic reconstruction of types and effects , 1991, POPL '91.

[27]  D. H. Bartley,et al.  Revised4 report on the algorithmic language scheme , 1991, LIPO.

[28]  Andrew W. Appel,et al.  Continuation-passing, closure-passing style , 1989, POPL '89.

[29]  Philip Wadler,et al.  Comprehending monads , 1990, LISP and Functional Programming.

[30]  Lawrence Charles Paulson,et al.  ML for the working programmer , 1991 .

[31]  Robin Milner,et al.  Definition of standard ML , 1990 .

[32]  John C. Reynolds,et al.  Definitional Interpreters for Higher-Order Programming Languages , 1972, ACM '72.