ABSTRACT
Datatype-generic programming is defining functions that depend on the structure, or "shape", of datatypes. It has been around for more than 10 years, and a lot of progress has been made, in particular in the lazy functional programming language Haskell. There are morethan 10 proposals for generic programming libraries orlanguage extensions for Haskell. To compare and characterise the many generic programming libraries in atyped functional language, we introduce a set of criteria and develop a generic programming benchmark: a set of characteristic examples testing various facets of datatype-generic programming. We have implemented the benchmark for nine existing Haskell generic programming libraries and present the evaluation of the libraries. The comparison is useful for reaching a common standard for generic programming, but also for a programmer who has to choose a particular approach for datatype-generic programming.
Supplemental Material
Available for Download
- F. Atanassow and J. Jeuring. Inferring type isomorphisms generically. In MPC'04, LNCS 3125, pages 32--53, 2004.Google Scholar
- J.-P. Bernardy, P. Jansson, M. Zalewski, S. Schupp, and A. Priesnitz. A comparison of C++ concepts and Haskell type classes. In ACM SIGPLAN Workshop on Generic Programming, 2008. Google Scholar
- R. Bird and L. Meertens. Nested datatypes. In J. Jeuring, editor, MPC'98, LNCS 1422, pages 52--67, 1998. Google Scholar
- B. Bringert and A. Ranta. A pattern for almost compositional functions. In ICFP'06, pages 216--226, 2006. Google Scholar
- J. Cheney and R. Hinze. A lightweight implementation of generics and dynamics. In Haskell'02, pages 90--104, 2002. Google Scholar
- K. Claessen and J. Hughes. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In ICFP'00, pages 286--279, 2000. Google Scholar
- D. Clarke and A. Löh. Generic haskell, specifically. In Proceedings of the IFIP TC2/WG2.1 Working Conference on Generic Programming, pages 21--47. Kluwer, B.V., 2003. Google Scholar
- J. Derrick and S. Thompson. FORSE: Formally-Based Tool Support for Erlang Development. Project description, 2005. URL http://www.cs.kent.ac.uk/projects/forse/.Google Scholar
- R. Garcia, J. Järvi, A. Lumsdaine, J. Siek, and J. Willcock. An extended comparative study of language support for generic programming. J. Funct. Program., 17(2):145--205, 2007. Google Scholar
- Haskell Generic Library list. Generic programming criteria template, 2008. Wiki page at haskell.org/haskellwiki/Applications_and_libraries/Generic_programming.Google Scholar
- T. Haskell Prime list. Haskell prime, 2006. Wiki page at http://hackage.haskell.org/trac/haskell-prime.Google Scholar
- R. Hinze. Generics for the masses. Journal of Functional Programming, 16:451--482, 2006. Google Scholar
- R. Hinze. Polytypic values possess polykinded types. Science of Computer Programming, 43(2-3):129--159, 2002.Google Scholar
- R. Hinze and A. Löh. "Scrap Your Boilerplate" revolutions. In MPC'06, LNCS 4014, pages 180--208, 2006. Google Scholar
- R. Hinze, A. Löh, and B. C. d. S. Oliveira. "Scrap Your Boilerplate" reloaded. In P. Wadler and M. Hagiya, editors, FLOPS'06, LNCS 3945, 2006. Google Scholar
- R. Hinze, J. Jeuring, and A. Löh. Comparing approches to generic programming in haskell. In Datatype-Generic Programming, LNCS 4719, pages 72--149. 2007. Google Scholar
- S. Holdermans, J. Jeuring, A. Löh, and A. Rodriguez. Generic views on data types. In T. Uustalu, editor, MPC'06, volume 4014 of LNCS, pages 209--234, 2006. Google Scholar
- P. Hudak, J. Hughes, S. Peyton Jones, and P. Wadler. A history of Haskell: being lazy with class. In HOPL III, pages 12-1--12-55, 2007. Google Scholar
Digital Library
- P. Jansson and J. Jeuring. PolyP - a polytypic programming language extension. In POPL'97, pages 470--482, 1997. Google Scholar
- P. Jansson and J. Jeuring. Polytypic data conversion programs. Science of Computer Programming, 43(1):35--75, 2002. Google Scholar
- P. Jansson and J. Jeuring. PolyLib - a polytypic function library. Workshop on Generic Programming, Marstrand, 1998.Google Scholar
- O. Kiselyov. Smash your boilerplate without class and typeable. http://article.gmane.org/gmane.comp.lang.haskell.general/14086, 2006.Google Scholar
- P. Koopman, A. Alimarine, J. Tretmans, and R. Plasmeijer. Gast: Generic automated software testing. In R. Peña and T. Arts, editors, IFL'02, volume 2670 of LNCS, 2003. Google Scholar
- R. Lämmel and S. Peyton Jones. Scrap your boilerplate: a practical approach to generic programming. In TLDI, pages 26--37, 2003.Google Scholar
- R. Lämmel and S. Peyton Jones. Scrap more boilerplate: reflection, zips, and generalised casts. In ICFP, pages 244--255, 2004.Google Scholar
- R. Lämmel and S. Peyton Jones. Scrap your boilerplate with class: extensible generic functions. In ICFP, pages 204--215, 2005.Google Scholar
- R. Lämmel and J. Visser. A Strafunski Application Letter. In PADL'03, LNCS 2562, pages 357--375, 2003. Google Scholar
- R. Lämmel and J. Visser. Typed combinators for generic traversal. In PADL'02, LNCS 2257, pages 137--154, 2002. Google Scholar
- H. Li, C. Reinke, and S. Thompson. Tool support for refactoring functional programs. In Haskell'03, pages 27--38, 2003. Google Scholar
- A. Löh, D. Clarke, and J. Jeuring. Depency-style Generic Haskell. In ICFP'03, pages 141--152, 2003. Google Scholar
- I. Lynagh. Template Haskell: A report from the field. http://www.comlab.ox.ac.uk/oucl/work/ian.lynagh/papers/, 2003.Google Scholar
- L. Meertens. Calculate polytypically! In H. Kuchen and S. D. Swierstra, editors, PLILP, LNCS 1140, pages 1--16, 1996. Google Scholar
- N. Mitchell and C. Runciman. A static checker for safe pattern matching in Haskell. In Trends in Functional Programming, volume 6. Intellect, 2007a.Google Scholar
- N. Mitchell and C. Runciman. Uniform boilerplate and list processing. In Haskell'07, 2007b. Google Scholar
- M. Naylor and C. Runciman. Finding inputs that reach a target expression. In SCAM'07, pages 133--142, 2007. Google Scholar
- U. Norell and P. Jansson. Polytypic programming in Haskell. In IFL'03, LNCS 3145, pages 168--184, 2004. Google Scholar
Index Terms
Comparing libraries for generic programming in haskell
Recommendations
Comparing libraries for generic programming in haskell
HASKELL '08Datatype-generic programming is defining functions that depend on the structure, or "shape", of datatypes. It has been around for more than 10 years, and a lot of progress has been made, in particular in the lazy functional programming language Haskell. ...
Generic programming for indexed datatypes
WGP '11: Proceedings of the seventh ACM SIGPLAN workshop on Generic programmingAn indexed datatype is a type that uses a parameter as a type-level tag; a typical example is the type of vectors, which are indexed over a type-level natural number encoding their length. Since the introduction of generalised algebraic datatypes, ...
Scala for generic programmers
WGP '08: Proceedings of the ACM SIGPLAN workshop on Generic programmingDatatype-generic programming involves parametrization by the shape of data, in the form of type constructors such as "list of". Most approaches to datatype-generic programming are developed in the lazy functional programming language Haskell. We argue ...







Comments