Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Scrap your boilerplate with class: extensible generic functions
[go: Go Back, main page]

Scrap your boilerplate with class: extensible generic functions

Authors
Ralf Lämmel and Simon Peyton-Jones

Note
See the Scrap your boilerplate website for more such work.

Abstract
The "Scrap your boilerplate" approach to generic programming allows the programmer to write generic functions that can traverse arbitrary data structures, and yet have type-specific cases. However, the original approach required all the type-specific cases to be supplied at once, when the recursive knot of generic function definition is tied. Hence, generic functions were closed. In contrast, Haskell's type classes support open, or extensible, functions that can be extended with new type-specific cases as new data types are defined. In this paper, we extend the "Scrap your boilerplate" approach to support this open style. On the way, we demonstrate the desirability of abstraction over type classes, and the usefulness of recursive dictionaries.

Bibtex entries
@inproceedings{SYB3,
 author = "Ralf L{\"a}mmel and Simon {Peyton Jones}",
 title = "{Scrap your boilerplate with class: extensible generic functions}",
 booktitle = "{Proceedings of the ACM SIGPLAN International Conference
               on Functional Programming (ICFP 2005)}",
 year      = {2005},
 pages     = {204--215},
 location  = {Tallinn, Estonia},
 publisher = {ACM Press},
 month = sep,
}

View paper

Download Haskell code from paper


Website maintained by Ralf Lämmel (Email: ralf@cwi.nl)