Comparing Datatype Generic Libraries in Haskell
نویسندگان
چکیده
Datatype-generic programming is about 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 more than 10 proposals for generic programming libraries or language extensions for Haskell. In this paper we compare and characterise the many generic programming libraries for Haskell. To that end, 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 ten 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.
منابع مشابه
Comparing Approaches to Generic Programming in Haskell
The last decade has seen a number of approaches to datatype-generic programming: PolyP, Functorial ML, ‘Scrap Your Boilerplate’, Generic Haskell, ‘Generics for the Masses’, and so on. The approaches vary in sophistication and target audience: some propose fullblown programming languages, some suggest libraries, some can be seen as categorical programming methods. In these lecture notes we compa...
متن کاملA Formal Comparison of Approaches to Datatype-Generic Programming
Datatype-generic programming increases program abstraction and reuse by making functions operate uniformly across different types. Many approaches to generic programming have been proposed over the years, most of them for Haskell, but recently also for dependently typed languages such as Agda. Different approaches vary in expressiveness, ease of use, and implementation techniques. Some work has...
متن کاملLibraries for Generic Programming in Haskell
These lecture notes introduce libraries for datatype-generic programming in Haskell. We introduce three characteristic generic programming libraries: lightweight implementation of generics and dynamics, extensible and modular generics for the masses, and scrap your boilerplate. We show how to use them to use and write generic programs. In the case studies for the different libraries we introduc...
متن کاملComparing Haskell and Scala Support for Generic Programming
Datatype-generic programming involves parametrization of programs by the shape of data, in the form of type constructors such as ‘list of’. Most approaches to datatype-generic programming are developed in pure functional programming languages such as Haskell. We argue that the functional object-oriented language Scala is in many ways a better choice. Not only does Scala provide equivalents of a...
متن کاملExperience Report: Functional Modelling of Musical Harmony
Music theory has been essential in composing and performing music for centuries. Within Western tonal music, from the early Baroque on to modern-day jazz and pop music, the function of chords within a chord sequence can be explained by harmony theory. Although Western tonal harmony theory is a thoroughly studied area, formalising this theory is a hard problem. We present a formalisation of the ...
متن کامل