Skip to main content

“Scrap Your Boilerplate” Reloaded

  • Conference paper
Functional and Logic Programming (FLOPS 2006)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 3945))

Included in the following conference series:

Abstract

The paper “Scrap your boilerplate” (SYB) introduces a combinator library for generic programming that offers generic traversals and queries. Classically, support for generic programming consists of two essential ingredients: a way to write (type-)overloaded functions, and independently, a way to access the structure of data types. SYB seems to lack the second. As a consequence, it is difficult to compare with other approaches such as PolyP or Generic Haskell. In this paper we reveal the structural view that SYB builds upon. This allows us to define the combinators as generic functions in the classical sense. We explain the SYB approach in this changed setting from ground up, and use the understanding gained to relate it to other generic programming approaches. Furthermore, we show that the SYB view is applicable to a very large class of data types, including generalized algebraic data types.

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

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Lämmel, R., Peyton Jones, S.: Scrap your boilerplate: a practical design pattern for generic programming. In: Types in Language Design and Implementation (2003)

    Google Scholar 

  2. Jansson, P., Jeuring, J.: PolyP – a polytypic programming language extension. In: Conference Record 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Paris, France, pp. 470–482. ACM Press, New York (1997)

    Chapter  Google Scholar 

  3. Löh, A.: Exploring Generic Haskell. PhD thesis, Utrecht University (2004)

    Google Scholar 

  4. Löh, A., Jeuring, J., Clarke, D., Hinze, R., Rodriguez, A., de Wit, J.: The Generic Haskell user’s guide, version 1.42 (Coral). Technical Report UU-CS-2005-004, Institute of Information and Computing Sciences, Utrecht University (2005)

    Google Scholar 

  5. Xi, H., Chen, C., Chen, G.: Guarded recursive datatype constructors. In: Proceedings of the ACM SIGPLAN-SIGACT symposium on Principles of Programming Languages (POPL 2003), pp. 224–235. ACM Press, New York (2003)

    Chapter  Google Scholar 

  6. Peyton Jones, S., Washburn, G., Weirich, S.: Wobbly types: Type inference for generalised algebraic data types. Technical Report MS-CIS-05-26, University of Pennsylvania (2004)

    Google Scholar 

  7. Peyton Jones, S. (ed.): Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)

    MATH  Google Scholar 

  8. Hinze, R., Löh, A., Oliveira, B.: Scrap Your Boilerplate reloaded. Technical report, Universität Bonn (2006), http://www.informatik.unionn.de/~loeh/SYB0.html

  9. GHC Team: The Glasgow Haskell Compiler User’s Guide (2005), http://haskell.org/ghc/docs/latest/users_guide.ps.gz

  10. Wadler, P.: Views: a way for pattern matching to cohabit with data abstraction. In: Principles of Programming Languages, pp. 307–313. ACM Press, New York (1987)

    Google Scholar 

  11. Burton, F.W., Meijer, E., Sansom, P., Thompson, S., Wadler, P.: Views: an extension to Haskell pattern matching (1996), http://www.haskell.org/development/views.html

  12. Holdermans, S., Jeuring, J., Löh, A.: Generic views on data types. Technical Report UU-CS-2005-012, Utrecht University (2005)

    Google Scholar 

  13. Benke, M., Dybjer, P., Jansson, P.: Universes for generic programs and proofs in dependent type theory. Nordic Journal of Computing 10, 265–289 (2003)

    MathSciNet  MATH  Google Scholar 

  14. Visser, E.: Language independent traversals for program transformation. In: Jeuring, J. (ed.) Workshop on Generic Programming (WGP 2000), Ponte de Lima, Portugal, Technical Report UU-CS-2000-19, Department of Information and Computing Sciences, Universiteit Utrecht (2000)

    Google Scholar 

  15. Hinze, R.: Fun with phantom types. In: Gibbons, J., de Moor, O. (eds.) The Fun of Programming, Palgrave, pp. 245–262 (2003); Scrap Your Boilerplate Reloaded 29

    Google Scholar 

  16. Oliveira, B., Gibbons, J.: Typecase: A design pattern for type-indexed functions. In: Haskell Workshop, pp. 98–109 (2005)

    Google Scholar 

  17. Li, H., Reinke, C., Thompson, S.: Tool support for refactoring functional programs. In: Jeuring, J. (ed.) HaskellWorkshop, pp. 27–38. Association for Computing Machinery (2003)

    Google Scholar 

  18. Wadler, P.: Theorems for free! Functional Programming and Computer Architecture (1989)

    Google Scholar 

  19. Lämmel, R., Peyton Jones, S.: Scrap more boilerplate: reflection, zips, and generalized casts. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP 2004), pp. 244–255. ACM Press, New York (2004)

    Google Scholar 

  20. Lämmel, R., Peyton Jones, S.: Scrap your boilerplate with class: extensible generic functions. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP 2005), pp. 204–215. ACM Press, New York (2005)

    Google Scholar 

  21. Backhouse, R., Jansson, P., Jeuring, J., Meertens, L.: Generic programming: An introduction. In: Swierstra, S.D., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 28–115. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  22. Hinze, R.: Polytypic values possess polykinded types. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 2–27. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  23. Holdermans, S.: Generic views. Master’s thesis, Utrecht University (2005)

    Google Scholar 

  24. Reig, F.: Generic proofs for combinator-based generic programs. In: Loidl, H.W. (ed.) Trends in Functional Programming, vol. 5. Intellect (2006)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2006 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Hinze, R., Löh, A., Oliveira, B.C.d.S. (2006). “Scrap Your Boilerplate” Reloaded. In: Hagiya, M., Wadler, P. (eds) Functional and Logic Programming. FLOPS 2006. Lecture Notes in Computer Science, vol 3945. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11737414_3

Download citation

  • DOI: https://doi.org/10.1007/11737414_3

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-33438-5

  • Online ISBN: 978-3-540-33439-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics