Skip to main content
    • Aa
    • Aa
  • Get access
    Check if you have access via personal or institutional login
  • Cited by 8
  • Cited by
    This article has been cited by the following publications. This list is generated based on data provided by CrossRef.

    Yallop, Jeremy Sheets, David and Madhavapeddy, Anil 2016. Functional and Logic Programming.

    Hu, Zhenjiang Hughes, John and Wang, Meng 2015. How functional programming mattered. National Science Review, Vol. 2, Issue. 3, p. 349.

    LÓPEZ-FRAGUAS, FRANCISCO JAVIER MARTIN-MARTIN, ENRIQUE and RODRÍGUEZ-HORTALÁ, JUAN 2015. A liberal type system for functional logic programs. Mathematical Structures in Computer Science, Vol. 25, Issue. 04, p. 942.

    Rendel, Tillmann Brachthäuser, Jonathan Immanuel and Ostermann, Klaus 2014. From object algebras to attribute grammars. ACM SIGPLAN Notices, Vol. 49, Issue. 10, p. 377.

    Magalhães, José Pedro and Löh, Andres 2012. A Formal Comparison of Approaches to Datatype-Generic Programming. Electronic Proceedings in Theoretical Computer Science, Vol. 76, p. 50.

    OLIVEIRA, BRUNO C. D. S. and GIBBONS, JEREMY 2010. Scala for generic programmers. Journal of Functional Programming, Vol. 20, Issue. 3-4, p. 303.

    VERBRUGGEN, WENDY DE VRIES, EDSKO and HUGHES, ARTHUR 2010. Formal polytypic programs and proofs. Journal of Functional Programming, Vol. 20, Issue. 3-4, p. 213.

    Hinze, Ralf and Löh, Andres 2009. Generic programming in 3D. Science of Computer Programming, Vol. 74, Issue. 8, p. 590.


Generics for the masses

  • RALF HINZE (a1)
  • DOI:
  • Published online: 10 August 2006

A generic function is a function that can be instantiated on many data types to obtain data type specific functionality. Examples of generic functions are the functions that can be derived in Haskell, such as show, read, and ‘==’. The recent years have seen a number of proposals that support the definition of generic functions. Some of the proposals define new languages, some define extensions to existing languages. As a common characteristic none of the proposals can be made to work within Haskell 98: they all require something extra, either a more sophisticated type system or an additional language construct. The purpose of this paper is to show that one can, in fact, program generically within Haskell 98 obviating to some extent the need for fancy type systems or separate tools. Haskell's type classes are at the heart of this approach: they ensure that generic functions can be defined succinctly and, in particular, that they can be used painlessly. We detail three different implementations of generics both from a practical and from a theoretical perspective.

Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *