Generic Generic Programming

  • José Pedro Magalhães
  • Andres Löh
Conference paper

DOI: 10.1007/978-3-319-04132-2_15

Part of the Lecture Notes in Computer Science book series (LNCS, volume 8324)
Cite this paper as:
Magalhães J.P., Löh A. (2014) Generic Generic Programming. In: Flatt M., Guo HF. (eds) Practical Aspects of Declarative Languages. PADL 2014. Lecture Notes in Computer Science, vol 8324. Springer, Cham

Abstract

Generic programming (GP) is a form of abstraction in programming languages that serves to reduce code duplication by exploiting the regular structure of algebraic datatypes. Over the years, several different approaches to GP in Haskell have surfaced. These approaches are often similar, but certain differences make them particularly well-suited for one specific domain or application. As such, there is a lot of code duplication across GP libraries, which is rather unfortunate, given the original goals of GP.

To address this problem, we define conversions from one popular GP library representation to several others. Our work unifies many approaches to GP, and simplifies the life of both library writers and users. Library writers can define their approach as a conversion from our library, obviating the need for writing meta-programming code for generation of conversions to and from the generic representation. Users of GP, who often struggle to find “the right approach” to use, can now mix and match functionality from different libraries with ease, and need not worry about having multiple (potentially inefficient and large) code blocks for generic representations in different approaches.

Download to read the full conference paper text

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • José Pedro Magalhães
    • 1
  • Andres Löh
    • 2
  1. 1.Department of Computer ScienceUniversity of OxfordOxfordUK
  2. 2.Well-Typed LLPOxfordUK

Personalised recommendations