Distinguishing Data Structures and Functions: The Constructor Calculus and Functorial Types

  • C. Barry Jay
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2044)


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.


Data Type Natural Transformation Expressive Power Type Scheme Reduction Rule 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [Aa97]
    L Augustsson and all. Report on the functional programming language Haskell: version 1.4. Technical report, University of Glasgow, 1997.Google Scholar
  2. [ACPR95]
    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.zbMATHCrossRefGoogle Scholar
  3. [BS98]
    R. Backhouse and T. Sheard, editors. Workshop on Generic Programming: Marstrand, Sweden, 18th June, 1998. Chalmers University of Technology, 1998.Google Scholar
  4. [CF92]
    J.R.B. Cockett and T. Fukushima. About Charity. Technical Report 92/480/18, University of Calgary, 1992.Google Scholar
  5. [Coc90]
    J.R.B. Cockett. List-arithmetic distributive categories: locoi. Journal of Pure and Applied Algebra, 66:1–29, 1990.zbMATHCrossRefMathSciNetGoogle Scholar
  6. [Ga77]
    J.A. Goguen and all. Initial algebra semantics and continuous algebras. Journal of the Association for Computing Machinery, 24:68–95, 1977.MathSciNetGoogle Scholar
  7. [GLT89]
    J-Y. Girard, Y. Lafont, and P. Taylor. Proofs and Types. Tracts in Theoretical Computer Science. Cambridge University Press, 1989.Google Scholar
  8. [Hen93]
    F. Henglein. Type inference with polymorphic recursion. ACM Trans. on Progr. Lang. and Sys., 15:253–289, 1993.CrossRefGoogle Scholar
  9. [Hin00]
    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.Google Scholar
  10. [Hyl82]
    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.Google Scholar
  11. [Jan00]
    P. Jansson. Functional Polytypic Programming. PhD thesis, Chalmers University, 2000.Google Scholar
  12. [Jay95a]
    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.Google Scholar
  13. [Jay95b]
    C.B. Jay. A semantics for shape. Science of Computer Programming, 25:251–283, 1995.zbMATHCrossRefMathSciNetGoogle Scholar
  14. [Jay96]
    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.Google Scholar
  15. [Jay00]
    C.B. Jay. Distinguishing data structures and functions: the constructor calculus and functorial types., 2000.
  16. [JBM98]
    C.B. Jay, G. Bellé, and E. Moggi. Functorial ML. Journal of Functional Programming, 8(6):573–619, 1998.zbMATHCrossRefMathSciNetGoogle Scholar
  17. [Jeu00]
    J. Jeuring, editor. Proceedings: Workshop on Generic Programming (WGP2000): July 6, 2000, Ponte de Lima, Portugal. Utrecht University, UU-CS-2000-19, 2000.Google Scholar
  18. [JJ97]
    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.Google Scholar
  19. [Klo80]
    J.W. Klop. Combinatory Reduction Systems. PhD thesis, Mathematical Center Amsterdam, 1980. Tracts 129.Google Scholar
  20. [MFP91]
    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.Google Scholar
  21. [Mil78]
    R. Milner. A theory of type polymorphism in programming. JCSS, 17, 1978.Google Scholar
  22. [MT91]
    R. Milner and M. Tofte. Commentary on Standard ML. MIT Press, 1991.Google Scholar
  23. [Rey85]
    J. Reynolds. Types, abstraction, and parametric polymorphism. In R.E.A. Mason, editor, Information Processing’ 83. North Holland, 1985.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • C. Barry Jay
    • 1
  1. 1.University of TechnologySydneyAustralia

Personalised recommendations