[go: up one dir, main page]

Skip to main content

Programming with Constructor Classes (preliminary summary)

  • Conference paper
Functional Programming, Glasgow 1992

Part of the book series: Workshops in Computing ((WORKSHOPS COMP.))

  • 91 Accesses

Abstract

As functional programmers, we are comfortable with the idea of mapping a function across the members of a list to obtain a new list of values. But there are very similar ways of mapping functions across other kinds of data structure, so what is special about lists? Why can’t we use the same name for each of these functions leaving the type system to determine which is appropriate in a particular situation? This is not just a matter of aesthetics or syntax since it would allow us to write general functions for any data structure that has an associated map function without having to repeat essentially the same definition in each case.

This paper describes a system of overloading based on the use of constructor classes — a natural generalization of type classes in Haskell — which provides a satisfactory solution to this problem and appears to have many other useful applications. We illustrate this with some examples using Wadler’s monadic style of programming, including the first concrete implementation of monad comprehensions known to us at the time of writing.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

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.

Similar content being viewed by others

References

  • Kung Chen, Paul Hudak, and Martin Odersky (1992). Parametric type classes (Extended abstract). ACM conference on LISP and Functional Programming, San Francisco, California, June 1992.

    Google Scholar 

  • Paul Hudak, Simon L. Peyton Jones and Philip Wadler (eds.) (1992). Report on the programming language Haskell, version 1.2. ACM SIGPLAN notices, 27, 5, May 1992.

    Google Scholar 

  • Mark P. Jones (1992a) A theory of qualified types. In,nth European Symposium on Programming, Rennes, France, Springer Verlag LNCS 582, February 1992.

    Google Scholar 

  • Mark P. Jones (1992b) Qualified types: Theory and practice. D.Phil. Thesis, Programming Research Group, Oxford University Computing Laboratory, July 1992.

    Google Scholar 

  • Eugenio Moggi (1989). Computational lambda-calculus and monads. IEEE Symposium on Logic in Computer Science, Asilomar, California, June 1989.

    Google Scholar 

  • Mike Spivey (1990). A functional theory of exceptions. Science of Computer Programming, 14(1), June 1990.

    Google Scholar 

  • Philip Wadler and Stephen Blott (1989). How to make ad-hoc polymorphism less ad-hoc. In 16th ACMannual symposium on Principles of Programming Languages, Austin, Texas, January 1989.

    Google Scholar 

  • Philip Wadler (1990). Comprehending Monads. ACM conference on LISP and Functional Programming, Nice, France, June 1990.

    Google Scholar 

  • Philip Wadler (1992). The essence of functional programming. In 19th Annual Symposium on Principles of Programming Languages, Santa Fe, New Mexico, January 1992.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1993 British Computer Society

About this paper

Cite this paper

Jones, M.P. (1993). Programming with Constructor Classes (preliminary summary). In: Launchbury, J., Sansom, P. (eds) Functional Programming, Glasgow 1992. Workshops in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-3215-8_11

Download citation

  • DOI: https://doi.org/10.1007/978-1-4471-3215-8_11

  • Publisher Name: Springer, London

  • Print ISBN: 978-3-540-19820-8

  • Online ISBN: 978-1-4471-3215-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics