Skip to main content

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

  • Conference paper
  • First Online:
Book cover Typed Lambda Calculi and Applications (TLCA 2001)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2044))

Included in the following conference series:

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.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. L Augustsson and all. Report on the functional programming language Haskell: version 1.4. Technical report, University of Glasgow, 1997.

    Google Scholar 

  2. 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.

    Article  MATH  Google Scholar 

  3. R. Backhouse and T. Sheard, editors. Workshop on Generic Programming: Marstrand, Sweden, 18th June, 1998. Chalmers University of Technology, 1998.

    Google Scholar 

  4. J.R.B. Cockett and T. Fukushima. About Charity. Technical Report 92/480/18, University of Calgary, 1992.

    Google Scholar 

  5. J.R.B. Cockett. List-arithmetic distributive categories: locoi. Journal of Pure and Applied Algebra, 66:1–29, 1990.

    Article  MATH  MathSciNet  Google Scholar 

  6. J.A. Goguen and all. Initial algebra semantics and continuous algebras. Journal of the Association for Computing Machinery, 24:68–95, 1977.

    MathSciNet  Google Scholar 

  7. J-Y. Girard, Y. Lafont, and P. Taylor. Proofs and Types. Tracts in Theoretical Computer Science. Cambridge University Press, 1989.

    Google Scholar 

  8. F. Henglein. Type inference with polymorphic recursion. ACM Trans. on Progr. Lang. and Sys., 15:253–289, 1993.

    Article  Google Scholar 

  9. 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. 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. P. Jansson. Functional Polytypic Programming. PhD thesis, Chalmers University, 2000.

    Google Scholar 

  12. 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. C.B. Jay. A semantics for shape. Science of Computer Programming, 25:251–283, 1995.

    Article  MATH  MathSciNet  Google Scholar 

  14. 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. 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.

  16. C.B. Jay, G. Bellé, and E. Moggi. Functorial ML. Journal of Functional Programming, 8(6):573–619, 1998.

    Article  MATH  MathSciNet  Google Scholar 

  17. 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. 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. J.W. Klop. Combinatory Reduction Systems. PhD thesis, Mathematical Center Amsterdam, 1980. Tracts 129.

    Google Scholar 

  20. 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. R. Milner. A theory of type polymorphism in programming. JCSS, 17, 1978.

    Google Scholar 

  22. R. Milner and M. Tofte. Commentary on Standard ML. MIT Press, 1991.

    Google Scholar 

  23. J. Reynolds. Types, abstraction, and parametric polymorphism. In R.E.A. Mason, editor, Information Processing’ 83. North Holland, 1985.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics