What is a purely functional language?

Functional programming languages are informally classified into pure and impure languages. The precise meaning of this distinction has been a matter of controversy. We therefore investigate a formal definition of purity. We begin by showing that some proposed definitions which rely on confluence, soundness of the beta axiom, preservation of pure observational equivalences and independence of the order of evaluation, do not withstand close scrutiny. We propose instead a definition based on parameter-passing independence. Intuitively, the definition implies that functions are pure mappings from arguments to results; the operational decision of how to pass the arguments is irrelevant. In the context of Haskell, our definition is consistent with the fact that the traditional call-by-name denotational semantics coincides with the traditional call-by-need implementation. Furthermore, our definition is compatible with the stream-based, continuation-based and monad-based integration of computational effects in Haskell. Finally, we observe that call-by-name reasoning principles are unsound in compilers for monadic Haskell.

[1]  Vincent van Oostrom,et al.  Combinatory Reduction Systems: Introduction and Survey , 1993, Theor. Comput. Sci..

[2]  Amr Sabry,et al.  Monadic state: axiomatization and type safety , 1997, ICFP '97.

[3]  John C. Reynolds,et al.  The essence of ALGOL , 1997 .

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

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

[6]  Matthias Felleisen,et al.  On the Expressive Power of Programming Languages , 1990, European Symposium on Programming.

[7]  Martin Odersky,et al.  The call-by-need lambda calculus , 1998, Journal of Functional Programming.

[8]  Paul Hudak,et al.  Call by name, assignment, and the lambda calculus , 1993, POPL '93.

[9]  Peter W. O'Hearn Note on Algol and Conservatively Extending Functional Programming , 1996, J. Funct. Program..

[10]  Amr Sabry,et al.  Reasoning about Explicit and Implicit Representations of State , 1993 .

[11]  G.D. Plotkin,et al.  LCF Considered as a Programming Language , 1977, Theor. Comput. Sci..

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

[13]  Simon L. Peyton Jones,et al.  State in Haskell , 1995, LISP Symb. Comput..

[14]  Matthias Felleisen,et al.  On the orthogonality of assignments and procedures in Algol , 1993, POPL '93.

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

[16]  Matthias Felleisen,et al.  Fully Abstract Semantics for Observably Sequential Languages , 1994, Inf. Comput..

[17]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[18]  Andrzej Filinski,et al.  Representing monads , 1994, POPL '94.

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

[20]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[21]  Matthias Felleisen,et al.  Observable sequentiality and full abstraction , 1992, POPL '92.

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

[23]  Robert Hieb,et al.  The Revised Report on the Syntactic Theories of Sequential Control and State , 1992, Theor. Comput. Sci..

[24]  Simon L. Peyton Jones,et al.  Report on the programming language Haskell: a non-strict, purely functional language version 1.2 , 1992, SIGP.