OXFORD UNIVERSITY COMPUTING LABORATORY

Generics as a Library

Bruno C. d. S. Oliveira, Ralf Hinze, and Andres Loeh

abstract

A generic function is a function that is defined on the structure of data types: with a single definition, we obtain a function that works for many data types. In contrast, an ad-hoc polymorphic function requires a separate implementation for each data type. Previous work by Hinze on lightweight generic programming has introduced techniques that allow the definition of generic functions directly in Haskell. A severe drawback of these approaches is that generic functions, once defined, cannot be extended with ad-hoc behaviour for new data types, precluding the design of an extensible and modular generic programming library based on these techniques. In this paper, we present a revised version of Hinze's Generics for the masses approach that overcomes this limitation. Using our new technique, writing an extensible and modular generic programming library in Haskell 98 is possible.

info

book title

Trends in Functional Programming (TFP 2006)

editor

Henrik Nilsson

location

University of Nottingham, UK

month

April

note

Draft Proceedings

year

2006

links

BibTeX

Link (pdf)

related pages

people

Random Image
Random Image
Random Image