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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Ralf Hinze and Simon Peyton Jones. Derivable Type Classes. In Graham Hutton, editor, Proceedings of the Fourth HaskellWorkshop, Montreal, Canada, September 17, 2000
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.
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.
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.
Juan Chen and Andrew W. Appel. Dictionary Passing for Polytypic Polymorphism Princeton University Computer Science TR-635-01, March 2001.
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.
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
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.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Alimarine, A., Plasmeijer, R. (2002). A Generic Programming Extension for Clean. In: Arts, T., Mohnen, M. (eds) Implementation of Functional Languages. IFL 2001. Lecture Notes in Computer Science, vol 2312. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-46028-4_11
Download citation
DOI: https://doi.org/10.1007/3-540-46028-4_11
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43537-2
Online ISBN: 978-3-540-46028-2
eBook Packages: Springer Book Archive