Advertisement

A Generic Programming Extension for Clean

  • Artem Alimarine
  • Rinus Plasmeijer
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2312)

Abstract

Generic programming enables the programmer to define functions by induction on the structure of types. Defined once, such a generic function can be used to generate a specialized function for any user defined data type. Several ways to support generic programming in functional languages have been proposed, each with its own pros and cons. In this paper we describe a combination of two existing approaches, which has the advantages of both of them. In our approach overloaded functions with class variables of an arbitrary kind can be defined generically. A single generic definition defines a kind-indexed family of overloaded functions, one for each kind. For instance, the generic mapping function generates an overloaded mapping function for each kind.

Additionally, we propose a separate extension that allows to specify a customized instance of a generic function for a type in terms of the generated instance for that type.

Keywords

Data Type Class Variable Generic Extension Conversion Function Primitive Type 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Ralf Hinze and Simon Peyton Jones. Derivable Type Classes. In Graham Hutton, editor, Proceedings of the Fourth HaskellWorkshop, Montreal, Canada, September 17, 2000Google Scholar
  2. 2.
    Ralf Hinze. Polytypic values possess polykinded types. In Roland Backhouse, J.N. Oliveira, editors, Proceedings of the Fifth International Conference on Mathematics of Program Construction (MPC 2000), Ponte de Lima, Portugal, July 3–5, 2000.Google Scholar
  3. 3.
    Ralf 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.Google Scholar
  4. 4.
    Ralf Hinze. A Generic Programming Extension for Haskell In Erik Meijer, editor, Proceedings of the Third Haskell Workshop, Paris, France, September 1999. The proceedings appear as a technical report of Universiteit Utrecht, UU-CS-1999-28.Google Scholar
  5. 5.
    Juan Chen and Andrew W. Appel. Dictionary Passing for Polytypic Polymorphism Princeton University Computer Science TR-635-01, March 2001.Google Scholar
  6. 6.
    P. Jansson and J. Jeuring, PolyP-a polytypic programming language extension, POPL’ 97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM Press 470–482, 1997.Google Scholar
  7. 7.
    M. J. Plasmeijer, M.C.J.D. van Eekelen Language Report Concurrent Clean. Version 1.3. Technical Report CSI R9816, Faculty of mathematics and Informatics, Catholic University of Nijmegen, June 1998. Also available at http://www.cs.kun.nl/~clean/Manuals/manuals.html
  8. 8.
    Ralf Lämmel, Joost Visser, and Jan Kort. Dealing with large bananas. In Johan Jeuring, editor, Workshop on Generic Programming, Ponte de Lima, July 2000. Technical Report UU-CS-2000-19, Universiteit Utrecht.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2002

Authors and Affiliations

  • Artem Alimarine
    • 1
  • Rinus Plasmeijer
    • 1
  1. 1.Nijmegen Institute for Information and Computing SciencesNijmegenThe Netherlands

Personalised recommendations