Distinguishing data structures and functions: the constructor calculus and functorial types

  • Authors:
  • C. Barry Jay

  • Affiliations:
  • University of Technology, Sydney

  • Venue:
  • TLCA'01 Proceedings of the 5th international conference on Typed lambda calculi and applications
  • Year:
  • 2001

Quantified Score

Hi-index 0.00

Visualization

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.