Skip to main content

Scrap Your Boilerplate

  • Conference paper
Programming Languages and Systems (APLAS 2003)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2895))

Included in the following conference series:

Abstract

Many programs traverse data structures built from rich mutually-recursive data types. Such programs often have a great deal of “boilerplate” code that simply walks the structure, hiding a small amount of “real” code that constitutes the reason for the traversal. ”Generic programming” is the umbrella term to describe a wide variety of programming technology directed at this problem. All these techniques aim to provide mechanical support for the “boilerplate” part, leaving the programmer free to concentrate on the important part of the algorithm. Such generic programs are much more robust to data structure evolution because they contain many fewer lines of type-specific code.

The trouble is that most generic programming techniques either require significant support from the programming language itself, or are inconvenient for the programmer. In this talk I will describe a new approach to generic programming based on the functional language Haskell, which combines programming convenience with very modest demands on the language. Our approach is simple to understand, elegant, reasonably efficient, and handles all the data types found in conventional functional programming languages. It makes essential use of rank-2 polymorphism, an extension found in some implementations of Haskell.

The talk is a development of work first reported in “Scrap your boilerplate”, Laemmel & Peyton Jones, Proc ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI 2003), New Orleans, Jan 2003.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2003 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Jones, S.P., Lämmel, R. (2003). Scrap Your Boilerplate. In: Ohori, A. (eds) Programming Languages and Systems. APLAS 2003. Lecture Notes in Computer Science, vol 2895. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-40018-9_23

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-40018-9_23

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-20536-4

  • Online ISBN: 978-3-540-40018-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics