Abstract
The expressive power of functional programming can be improved by identifying and exploiting the characteristics that distinguish data types from function types. Data types support generic functions for equality, mapping, folding, etc. that do not apply to functions. Such generic functions require case analysis, or pattern-matching, where the branches may have incompatible types, e.g. products or sums. This is handled in the constructor calculus where specialisation of program extensions is governed by constructors for data types. Typing of generic functions employs polymorphism over functors in a functorial type system. The expressive power is greatly increased by allowing the functors to be polymorphic in the number of arguments they take, i.e. in their arities. The resulting system can define and type the fundamental examples above. Some basic properties are established, namely subject reduction, the Church-Rosser property, and the existence of a practical type inference algorithm.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
L Augustsson and all. Report on the functional programming language Haskell: version 1.4. Technical report, University of Glasgow, 1997.
M. Abadi, L. Cardelli, B.C. Pierce, and D. Rémy. Dynamic typing in polymorphic languages. Journal of Functional Programming, 5(1):111–130, 1995.
R. Backhouse and T. Sheard, editors. Workshop on Generic Programming: Marstrand, Sweden, 18th June, 1998. Chalmers University of Technology, 1998.
J.R.B. Cockett and T. Fukushima. About Charity. Technical Report 92/480/18, University of Calgary, 1992.
J.R.B. Cockett. List-arithmetic distributive categories: locoi. Journal of Pure and Applied Algebra, 66:1–29, 1990.
J.A. Goguen and all. Initial algebra semantics and continuous algebras. Journal of the Association for Computing Machinery, 24:68–95, 1977.
J-Y. Girard, Y. Lafont, and P. Taylor. Proofs and Types. Tracts in Theoretical Computer Science. Cambridge University Press, 1989.
F. Henglein. Type inference with polymorphic recursion. ACM Trans. on Progr. Lang. and Sys., 15:253–289, 1993.
R. Hinze. A new approach to generic functional programming. In Proceedings of the 27th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Boston, Massachusetts, January 19–21, 2000, 2000.
J.M.E. Hyland. The effective topos. In A.S. Troelstra and D. van Dalen, editors, The L.E.J. Brouwer Centenary Symposium. North Holland, 1982.
P. Jansson. Functional Polytypic Programming. PhD thesis, Chalmers University, 2000.
C.B. Jay. Polynomial polymorphism. In R. Kotagiri, editor, Proceedings of the Eighteenth Australasian Computer Science Conference: Glenelg, South Australia 1–3 February, 1995, volume 17, pages 237–243. A.C.S. Communications, 1995.
C.B. Jay. A semantics for shape. Science of Computer Programming, 25:251–283, 1995.
C.B. Jay. Data categories. In M.E. Houle and P. Eades, editors, Computing: The Australasian Theory Symposium Proceedings, Melbourne, Australia, 29–30 January, 1996, volume 18, pages 21–28. Australian Computer Science Communications, 1996. ISSN 0157-3055.
C.B. Jay. Distinguishing data structures and functions: the constructor calculus and functorial types. http://www-staff.it.uts.edu.au/~cbj/Publications/constructors.ps, 2000.
C.B. Jay, G. Bellé, and E. Moggi. Functorial ML. Journal of Functional Programming, 8(6):573–619, 1998.
J. Jeuring, editor. Proceedings: Workshop on Generic Programming (WGP2000): July 6, 2000, Ponte de Lima, Portugal. Utrecht University, UU-CS-2000-19, 2000.
P. Jansson and J. Jeuring. PolyP — a polytypic programming language extension. In POPL’ 97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 470–482. ACM Press, 1997.
J.W. Klop. Combinatory Reduction Systems. PhD thesis, Mathematical Center Amsterdam, 1980. Tracts 129.
E. Meijer, M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In J. Hughes, editor, Procceding of the 5th ACM Conference on Functional Programming and Computer Architecture, volume 523 of Lecture Notes in Computer Science, pages 124–44. Springer Verlag, 1991.
R. Milner. A theory of type polymorphism in programming. JCSS, 17, 1978.
R. Milner and M. Tofte. Commentary on Standard ML. MIT Press, 1991.
J. Reynolds. Types, abstraction, and parametric polymorphism. In R.E.A. Mason, editor, Information Processing’ 83. North Holland, 1985.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Barry Jay, C. (2001). Distinguishing Data Structures and Functions: The Constructor Calculus and Functorial Types. In: Abramsky, S. (eds) Typed Lambda Calculi and Applications. TLCA 2001. Lecture Notes in Computer Science, vol 2044. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45413-6_19
Download citation
DOI: https://doi.org/10.1007/3-540-45413-6_19
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-41960-0
Online ISBN: 978-3-540-45413-7
eBook Packages: Springer Book Archive