Springer Nature is making SARS-CoV-2 and COVID-19 research free. View research | View latest news | Sign up for updates

From Curry to Haskell

Paths to Abstraction in Programming Languages

  • 14 Accesses

Abstract

We expose some basic elements of a style of programming supported by functional languages like Haskell by relating them to a coherent set of notions and techniques from Curry’s work in combinatory logic and formal systems, and their algebraic and categorical interpretations. Our account takes the form of a commentary to a simple fragment of Haskell code attempting to isolate the conceptual sources of the linguistic abstractions involved.

This is a preview of subscription content, log in to check access.

Fig. 1

Notes

  1. 1.

    Also the MIT course notes on programming linguistics (Wozencraft and Evans 1971), strongly influenced by lectures held at MIT by Landin and Strachey, use some of Curry’s terminology, speaking of “obs” and their “representations”.

  2. 2.

    Curry (1952, 1958) observed the analogy between formal systems and abstract algebras, pointing out also their main differences, namely the fact that in an algebra, “the elements are conceived as existing beforehand” , where in a formal system “what is given beforehand is not a set of elements but the atoms and operations, and the obs are generated from them” (Curry and Feys 1958, §1B1).

  3. 3.

    As an aside, we point out that Giovanni Vailati, a collaborator of Peano, had already studied the language of algebra and its grammar, in “La grammatica dell’algebra” (Rivista di Psicologia Applicata, 4, 1908), to which Peano replied more than twenty years later with his “Algebra de Grammatica”, Schola et Vita, vol. V (1930) pp. 323–336, where he outlines an algebraic approach to grammar based on the categories of verb, noun, and adjective that is strongly reminiscent of the more successful subsequent attempts by Ajdukiewicz, Bar Hillel, and especially Lambek.

  4. 4.

    Some proviso is needed, however, on the correspondence between programming language constructs and logical and algebraic notions. For example, in languages with lazy pattern matching, like Haskell, the elements of type Nat are not in bijective correspondence with the natural numbers: in Haskell, we can define infty = Succ infty for which the compiler infers type Nat, which does not correspond to any natural number but can nevertheless be used significantly as an argument of functions without causing non-terminating behavior (see Bird (1998) for examples). Other expressions for which the type Nat can be inferred but which do not correspond to any natural number are introduced by defining bottom = bottom and then taking bottom, Succ bottom, Succ (Succ bottom), … The type Nat is more accurately modeled by a partially ordered set enjoying a special completeness property in the order-theoretic sense – a cpo; here, in addition to natural numbers, there is an infinite totally ordered subset whose elements corresponding to elements of Nat that involve bottom, whose least upper bound is the element corresponding to infty. This structure is still an initial algebra, but in a suitable category of cpo’s (Freyd 1991).

  5. 5.

    Observe that also the terms “closure” and “formation” are ambiguous and may refer both to processes and to their results, exactly like “construction”.

  6. 6.

    The interest of T-algebras in a computational setting can also be seen from their use in the categorical investigations on classes of automata by Arbib, Manes, and several others, in the early 1970s. There, a central notion is that of dynamics that generalizes the transition function of an automaton δ : X × QQ, where X is the input alphabet and Q the set of states of the automaton. The observation that the construction X ×⋅ is an endofunctor over the category of sets makes this notion of dynamics a special case of the general categorical definition of an algebra of an endofunctor \(T: {\mathscr{C}} \longrightarrow {\mathscr{C}}\). In the context of the categorical reconstruction of automata theory, T-algebras were usually studied through the free monad over T (see Arbib and Manes (1974) for an early survey of this field). Monads have come to play an important role in structuring Haskell programs, although through a different path, following pioneering work by Moggi, Spivey, and Wadler in the late 1980s.

  7. 7.

    See Schroeder-Heister (2008) and Moriconi and Tesconi (2008) for recent investigations.

  8. 8.

    See Thompson (1991) for more on the application of the inversion principle to programming.

References

  1. Adámek, J. (1974). Free algebras and automata realizations in the language of categories. Commentationes Mathematicae Universitatis Carolinae, 15(4), 589–602.

  2. Arbib, M.A., & Manes, E.G. (1974). Machines in a category: an expository introduction. SIAM Review, 16(2), 163–192.

  3. Bauer, F.L. (1990). The cellar principle of state transition and storage allocation. IEEE Annals of the History of Computing, 12(1), 41–49.

  4. Bauer, F.L. (2002). From the stack principle to ALGOL. In Broy, M., & Denert, E. (Eds.) Software Pioneers (pp. 26–42). Berlin: Springer.

  5. Bird, R.S. (1987). An introduction to the theory of lists. In Broy, M. (Ed.) Logic of Programming and Calculi of Discrete Design, Springer-Verlag, pp 3–42, NATO ASI Series F Volume 36. Also available as Technical Monograph PRG-56, from the Programming Research Group, Oxford University.

  6. Bird, R.S. (1998). Introduction to Functional Programming Using Haskell. Prentice-Hall.

  7. Bird, R.S., & Meertens, L. (1987). Two exercises found in a book on algorithmics. In Meertens, L. (Ed.) Program Specification and Transformation (pp. 451–457). North-holland.

  8. Bobryk, J. (2009). The genesis and history of Twardowski’s theory of actions and products. In Lapointe, S., Wolénski, J., Marion, M., Miskiewicz, W. (Eds.) The Golden age of Polish Philosophy: Kazimierz twardowski’s Philosophical Legacy (pp. 33–42). Netherlands: Springer.

  9. Böhm, C, & Berarducci, A. (1985). Automatic synthesis of typed λ-programs on term algebras. Theoretical Computer Science, 39, 135–154.

  10. Burks, A.W., Warren, D.W., Wright, J.B. (1954). An analysis of a logical machine using parenthesis-free notation. Mathematical Tables and Other Aids to Computation, 8, 53–57.

  11. Burstall, R.M. (1969). Proving properties of programs by structural induction. The Computer Journal, 12(1), 41–48.

  12. Burstall, R.M., & Landin, P.J. (1969). Programs and their proofs: an algebraic approach. In Meltzer, B., & Michie, D. (Eds.) Machine Intelligence, (Vol. 4 pp. 17–43): Edinburgh University Press.

  13. Cohn, P. (1965). Universal algebra. Harper’s series in modern mathematics, Harper & Row.

  14. Coquand, T., & Huet, G. (1988). The calculus of constructions. Information and Computation, 76, 95–120.

  15. Curry, H.B. (1934). Functionality in combinatory logic. Proceedings of the National Academy of Sciences of the USA, 20, 584–590.

  16. Curry, H.B. (1941). Some aspects of the problem of mathematical rigor. Bulletin of the American Mathematical Society, 47, 221–241.

  17. Curry, H.B. (1950). Language, metalanguage, and formal systems. Philosophical Review, 59, 346–353.

  18. Curry, H.B. (1951). Outlines of a Formalist Philosophy of Mathematics. Amsterdam: North-Holland Co.

  19. Curry, H.B. (1952). On the definition of substitution, replacement and allied notions in an abstract formal system. Revue Philosophique de Louvain, 50, 251–269.

  20. Curry, H.B. (1953). Mathematics, syntactics and logic. Mind, 62, 172–183.

  21. Curry, H.B. (1961). Some logical aspects of grammatical structure. In Jakobson, R. (Ed.) Structure of Language and its Mathematical Aspects, no. 12 in Proceedings of Symposia in Applied Mathematics (pp. 56–68). Providence: American Mathematical Society.

  22. Curry, H.B. (1963). Foundations of Mathematical Logic. McGraw-Hill, New York reprinted 1977. New York: Dover Inc.

  23. Curry, H.B., & Feys, R. (1958). Combinatory Logic, Volume I. Amsterdam: North-Holland Co. (3rd edn. 1974).

  24. Curry, H.B., Hindley, J.R., Seldin, J.P. (1972). Combinatory Logic Volume II. Amsterdam: North-Holland Co.

  25. Danvy, O., & Spivey, M. (2007). On Barron and Strachey’s Cartesian Product Function. In Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, ICFP ’07 (pp. 41–46).

  26. De Mol, L. (2006). Closing the circle: an analysis of Emil Post’s early work. Bulletin of Symbolic Logic, 12(2), 267–289.

  27. Dedekind, R. (1888). Was sind und was sollen die Zahlen?, 1st edn. Verlag von Friedrich Vieweg und Sohn, Braunschweig, translation by W.W. Beman in Essays on the Theory of Numbers (1901), reprinted in 1963 by Dover Press.

  28. Fiore, M.P. (1996). A coinduction principle for recursive data types based on bisimulation. Information and Computation, 127(2), 186–198.

  29. Frascolla, P. (1997). The Tractatus system of arithmetic. Synthese, 112(3), 353–378.

  30. Freyd, P.J. (1991). Algebraically complete categories. In Carboni, A., Pedicchio, M., Rosolini, G. (Eds.) Proceedings of the 1990 Como Category Theory Conference, (Vol. 1488 pp. 131–156). Berlin: Springer-Verlag, Lecture Notes in Mathematics.

  31. Gentzen, G. (1935). Untersuchungen über das logische Schliessen. Mathematische Zeitschrift, 39, 176–210. 405–431.

  32. Goguen, J., Thatcher, J., Wagner, E., Wright, J. (1977). Initial algebra semantics and continuous algebras. Journal of the ACM, 24, 68–95.

  33. Gorn, S. (1959). Introductory speech. In Proceedings of the International Conference on Information Processing (pp. 117–118). Paris: UNESCO.

  34. Hindley, J.R. (1969). The principal type-scheme of an object in combinatory logic. Transactions of the American Mathematical Society, 146, 29–60.

  35. Hoare, C.A.R. (1972). Notes on data structuring. In Dahl, O.J., Dijkstra, E.W., Hoare, C.A.R. (Eds.) Structured Programming (pp. 83–174). London: Academic Press Ltd.

  36. Hudak, P., Hughes, J., Peyton Jones, S.L., Wadler, P. (2007). A history of Haskell: being lazy with class. In Proceedings of the Third ACM SIGPLAN History of Programming Languages Conference (HOPL-III) (pp. 1–55). San Diego, California, USA, 9-10 June 2007.

  37. Iverson, K.E. (1962). A Programming Language. New York: Wiley.

  38. Lambek, J. (1968). A fixpoint theorem for complete categories. Mathematische Zeitschrift, 103, 151–161.

  39. Landin, P.J. (1964). The mechanical evaluation of expressions. The Computer Journal, 6, 308–320.

  40. Lorenzen, P. (1955). Einführung in die Operative Logik und Mathematik. Berlin: Springer.

  41. Martin-Löf, P. (1982). Constructive mathematics and computer programming. In Cohen, L.J., ŁOs, J., Pfeiffer, H., Podewski, K.P. (Eds.) Logic, Methodology and Philosophy of Science, VI (pp. 153–175). Amsterdam: North-Holland Co.

  42. McCarthy, J. (1963). Towards a mathematical science of computation. In Popplewell, C.M. (Ed.) Information Processing 62:Proceedings of the IFIP Congress 1962 (pp. 21–28). Amsterdam: North-Holland Co.

  43. Meijer, E., Fokkinga, M.M., Paterson, R. (1991). Functional programming with bananas, lenses, envelopes and barbed wire. In Functional Programming Languages and Computer Architecture, 5th ACM Conference (pp. 124–144). Cambridge, MA, USA, August 26-30, 1991, Proceedings.

  44. Meyer, R.K. (1987). Curry’s philosophy of formal systems. Australasian Journal of Philosophy, 65(2), 156–171.

  45. Milner, R. (1978). A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17, 348–375.

  46. Moriconi, E., & Tesconi, L. (2008). On inversion principles. History and Philosophy of Logic, 29(2), 103–113.

  47. Post, E.L. (1943). Formal reductions of the general combinatorial decision problem. American Journal of Mathematics, 65(2), 197–215.

  48. Rosenbloom, P. (1950). The Elements of Mathematical Logic. New York: Dover Inc.

  49. van der Schaar, M. (2013). On the ambiguities of the term judgement; an evaluation of Twardowski’s distinction between action and product. In Chrudzimski, A., & Lukasiewicz, D. (Eds.) Actions, products, and things. Brentano and polish philosophy (pp. 35–54). Berlin and Boston: De Gruyter.

  50. Schroeder-Heister, P. (2008). Lorenzen’s operative justification of intuitionistic logic. In van Atten, M, Boldini, P, Bourdeau, M, Heinzmann, G (Eds.) One hundred years of intuitionism (1907–2007): The Cerisy Conference (pp. 214–240). Birkhäuser.

  51. Schroeder-Heister, P. (2018). Proof-theoretic semantics. In Zalta, E.N. (Ed.) The stanford encyclopedia of philosophy, spring 2018 edn, Metaphysics Research Lab, Stanford University.

  52. Seldin, J.P. (1975). Arithmetic as a study of formal systems. Notre Dame Journal of Formal Logic, 16(4), 449–464.

  53. Thompson, S. (1991). Type theory and functional programming. Addison Wesley Longman Publishing Co. Inc.

  54. Twardowski, K. (1999). Actions and products (1912). In Brandl, J., & Wolenski, J. (Eds.) On Actions, Products and Other Topics in Philosophy (pp. 103–132). Amsterdam: Rodopi.

  55. Wozencraft, J.M., & Evans, A. Jr. (1971). Notes on programming linguistics. Tech. rep. Massachusetts Institute of Technology, Cambridge, Massachusetts.

Download references

Acknowledgments

I am grateful to the anonymous referees for insightful comments that have led to a definite improvement of the original version. My warmest thanks also to Simone Martini for presenting the results of this paper at a project meeting that I could not attend.

Funding

The preparation of this paper has been financially supported by project PROGRAMme ANR-17-CE38-0003-01 (principal investigator Liesbeth De Mol).

Author information

Correspondence to Felice Cardone.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Cardone, F. From Curry to Haskell. Philos. Technol. (2020). https://doi.org/10.1007/s13347-019-00385-4

Download citation

Keywords

  • History of functional programming
  • Formal systems
  • Initial algebras
  • Inversion principle