Skip to main content

Libraries for Generic Programming in Haskell

  • Chapter
Advanced Functional Programming (AFP 2008)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 5832))

Included in the following conference series:

Abstract

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 introduce generic components of a medium-sized application which assists a student in solving mathematical exercises.

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.

References

  • Alexandrescu, A.: Modern C++ design: generic programming and design patterns applied. Addison-Wesley Longman Publishing Co., Inc., Boston (2001)

    Google Scholar 

  • Alimarine, A., Plasmijer, R.: A generic programming extension for Clean. In: Arts, T., Mohnen, M. (eds.) IFL 2002. LNCS, vol. 2312, pp. 168–186. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  • Alimarine, A., Smetsers, S.: Optimizing generic functions. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 16–31. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  • Altenkirch, T., McBride, C.: Generic programming within dependently typed programming. In: Gibbons, J., Jeuring, J. (eds.) Generic Programming. IFIP, vol. 243, pp. 1–20. Kluwer Academic Publishers, Dordrecht (2003)

    Chapter  Google Scholar 

  • Backhouse, R., de Bruin, P., Malcolm, G., Voermans, E., van der Woude, J.: Relational catamorphisms. In: Möller, B. (ed.) Proceedings of the IFIP TC2/WG2.1 Working Conference on Constructing Programs, pp. 287–318. Elsevier Science Publishers B.V, Amsterdam (1991)

    Google Scholar 

  • 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 

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

    MathSciNet  MATH  Google Scholar 

  • Bernardy, J.-P., Jansson, P., Zalewski, M., Schupp, S., Priesnitz, A.: A comparison of C++ concepts and Haskell type classes. In: ACM SIGPLAN Workshop on Generic Programming. ACM, New York (2008)

    Google Scholar 

  • Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development. In: Coq’Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. EATCS (2004), ISBN 3-540-20854-2

    Google Scholar 

  • Bird, R., Meertens, L.: Nested datatypes. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, pp. 52–67. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  • Bird, R., de Moor, O.: Algebra of programming. Prentice-Hall, Englewood Cliffs (1997)

    MATH  Google Scholar 

  • Cheney, J., Hinze, R.: A lightweight implementation of generics and dynamics. In: Chakravarty, M. (ed.) Proceedings of the 2002 ACM SIGPLAN workshop on Haskell, Haskell 2002, pp. 90–104. ACM, New York (2002)

    Google Scholar 

  • Claessen, K., Hughes, J.: Quickcheck: a lightweight tool for random testing of Haskell programs. In: Proceedings of the 5th ACM SIGPLAN International Conference on Functional Programming, ICFP 2000, pp. 268–279. ACM, New York (2000)

    Google Scholar 

  • Clavel, M., Durán, F., Martí-Oliet, N.: Polytypic programming in Maude. Electronic Notes in Theoretical Computer Science, vol. 36, pp. 339–360 (2000)

    Google Scholar 

  • Dornan, C., Jones, I., Marlow, S.: Alex User Guide (2003), http://www.haskell.org/alex

  • Fokkinga, M.M.: Law and Order in Algorithmics, PhD thesis. University of Twente (1992)

    Google Scholar 

  • Forman, I.R., Danforth, S.H.: Putting metaclasses to work: a new dimension in object-oriented programming. Addison Wesley Longman Publishing Co., Inc., Redwood City (1999)

    Google Scholar 

  • Garcia, R., Järvi, J., Lumsdaine, A., Siek, J., Willcock, J.: An extended comparative study of language support for generic programming. Journal of Functional Programming 17(2), 145–205 (2007)

    Article  MATH  Google Scholar 

  • Gibbons, J.: Datatype-generic programming. In: Backhouse, R., Gibbons, J., Hinze, R., Jeuring, J. (eds.) SSDGP 2006. LNCS, vol. 4719, pp. 1–71. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  • The Haskell Prime list. Haskell prime (2006), http://hackage.haskell.org/trac/haskell-prime

  • Hinze, R.: Generic programs and proofs. Bonn University, Habilitation (2000)

    Google Scholar 

  • Hinze, R.: Generics for the masses. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming, ICFP 2004, pp. 236–243. ACM, New York (2004)

    Google Scholar 

  • Hinze, R.: Generics for the masses. Journal of Functional Programming 16, 451–482 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  • Hinze, R., Jeuring, J.: Generic Haskell: applications. In: Backhouse, R., Gibbons, J. (eds.) Generic Programming. LNCS, vol. 2793, pp. 57–96. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  • Hinze, R., Jeuring, J.: Generic Haskell: practice and theory. In: Backhouse, R., Gibbons, J. (eds.) Generic Programming. LNCS, vol. 2793, pp. 1–56. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  • Hinze, R., Löh, A.: Generic programming in 3D. Science of Computer Programming (to appear, 2009)

    Google Scholar 

  • Hinze, R., Löh, A.: “Scrap Your Boilerplate” revolutions. In: Uustalu, T. (ed.) MPC 2006. LNCS, vol. 4014, pp. 180–208. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  • Hinze, R., Löh, A.: Generic programming, now! In: Backhouse, R., Gibbons, J., Hinze, R., Jeuring, J. (eds.) SSDGP 2006. LNCS, vol. 4719, pp. 150–208. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  • Hinze, R., Löh, A., Oliveira, B.C.d.S.: “Scrap Your Boilerplate” reloaded. In: Hagiya, M., Wadler, P. (eds.) FLOPS 2006. LNCS, vol. 3945, pp. 13–29. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  • Hinze, R., Jeuring, J., Löh, A.: Comparing approaches to generic programming in Haskell. In: Backhouse, R., Gibbons, J., Hinze, R., Jeuring, J. (eds.) SSDGP 2006. LNCS, vol. 4719, pp. 72–149. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  • Holdermans, S., Jeuring, J., Löh, A., Rodriguez, A.: Generic views on data types. In: Uustalu, T. (ed.) MPC 2006. LNCS, vol. 4014, pp. 209–234. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  • Jeuring, J., Leather, S., Magalhães, J.P., Yakushev, A.R.: Libraries for generic programming in Haskell. Technical Report UU-CS-2008-025, Department of Information and Computing Sciences. Utrecht University (2008)

    Google Scholar 

  • Karvonen, V.A.J.: Generics for the working ML’er. In: Proceedings of the 2007 Workshop on ML, ML 2007, pp. 71–82. ACM, New York (2007)

    Google Scholar 

  • Kiselyov, O.: Smash your boilerplate without class and typeable (2006), http://article.gmane.org/gmane.comp.lang.haskell.general/14086

  • Kiselyov, O.: Compositional gmap in SYB1 (2008), http://www.haskell.org/pipermail/generics/2008-July/000362.html

  • Lämmel, R., Jones, S.P.: Scrap your boilerplate: a practical approach to generic programming. In: Proceedings of the ACM SIGPLAN Workshop on Types in Language Design and Implementation, TLDI 2003, pp. 26–37. ACM, New York (2003)

    Chapter  Google Scholar 

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

    Google Scholar 

  • Lämmel, R., Jones, S.P.: 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, New York (2005)

    Google Scholar 

  • Lempsink, E., Leather, S., Löh, A.: Type-safe diff for families of datatypes (submitted for publication, 2009)

    Google Scholar 

  • Lodder, J., Jeuring, J., Passier, H.: An interactive tool for manipulating logical formulae. In: Manzano, M., Pérez Lancho, B., Gil, A. (eds.) Proceedings of the Second International Congress on Tools for Teaching Logic (2006)

    Google Scholar 

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

    Google Scholar 

  • Löh, A., Hinze, R.: Open data types and open functions. In: Maher, M. (ed.) Proceedings of the 8th ACM SIGPLAN symposium on Principles and practice of declarative programming, PPDP 2006, pp. 133–144. ACM, New York (2006)

    Google Scholar 

  • Malcolm, G.: Algebraic data types and program transformation. PhD thesis, Department of Computing Science. Groningen University (1990)

    Google Scholar 

  • Marlow, S., Gill, A.: Happy User Guide (1997), http://www.haskell.org/happy

  • Meertens, L.: Calculate polytypically! In: Kuchen, H., Swierstra, S.D. (eds.) PLILP 1996. LNCS, vol. 1140, pp. 1–16. Springer, Heidelberg (1996)

    Chapter  Google Scholar 

  • Meijer, E., Fokkinga, M., Paterson, R.: Functional programming with bananas, lenses, envelopes and barbed wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 124–144. Springer, Heidelberg (1991)

    Chapter  Google Scholar 

  • Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)

    Article  MathSciNet  MATH  Google Scholar 

  • Mitchell, N., Runciman, C.: Uniform boilerplate and list processing. In: Proceedings of the 2007 ACM SIGPLAN workshop on Haskell, Haskell 2007. ACM, New York (2007)

    Google Scholar 

  • Norell, U.: Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology and Göteborg University (2007)

    Google Scholar 

  • Norell, U., Jansson, P.: Polytypic programming in Haskell. In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 168–184. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  • Norell, U., Jansson, P.: Prototyping generic programming in Template Haskell. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 314–333. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  • Bruno C. d. S. Oliveira, Hinze, R., Löh, A.: Extensible and modular generics for the masses. In: Nilsson, H. (ed.) Revised Selected Papers from the Seventh Symposium on Trends in Functional Programming, TFP 2006, vol. 7, pp. 199–216 (2006)

    Google Scholar 

  • Palsberg, J., Barry Jay, C.: The essence of the visitor pattern. In: Proceedings of the 22nd IEEE Conference on International Computer Software and Applications, COMPSAC 1998, pp. 9–15 (1998)

    Google Scholar 

  • Passier, H., Jeuring, J.: Feedback in an interactive equation solver. In: Seppälä, M., Xambo, S., Caprotti, O. (eds.) Proceedings of the Web Advanced Learning Conference and Exhibition, WebALT 2006, pp. 53–68. Oy WebALT Inc. (2006)

    Google Scholar 

  • Pfeifer, H., Ruess, H.: Polytypic proof construction. In: Bertot, Y., Dowek, G., Hirschowitz, A., Paulin, C., Théry, L. (eds.) TPHOLs 1999. LNCS, vol. 1690, pp. 55–72. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  • Reinke, C.: Traversable functor data, or: X marks the spot (2008), http://www.haskell.org/pipermail/generics/2008-June/000343.html

  • Rodriguez, A.: Towards Getting Generic Programming Ready for Prime Time. PhD thesis, Utrecht University (2009)

    Google Scholar 

  • Rodriguez, A., Jeuring, J., Jansson, P., Gerdes, A., Kiselyov, O., Oliveira, B.C.d.S.: Comparing libraries for generic programming in haskell. Technical report, Utrecht University (2008a)

    Google Scholar 

  • Rodriguez, A., Jeuring, J., Jansson, P., Gerdes, A., Kiselyov, O., Oliveira, B.C.d.S.: Comparing libraries for generic programming in haskell. In: Haskell Symposium 2008 (2008b)

    Google Scholar 

  • Rodriguez, A., Holdermans, S., Löh, A., Jeuring, J.: Generic programming with fixed points for mutually recursive datatypes. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming, ICFP 2009 (2009)

    Google Scholar 

  • Sheard, T.: Using MetaML: A staged programming language. In: Revised Lectures of the Third International School on Advanced Functional Programming (1999)

    Google Scholar 

  • Sheard, T., Jones, S.P.: Template metaprogramming for Haskell. In: Chakravarty, M.M.T. (ed.) ACM SIGPLAN Haskell Workshop 2002, pp. 1–16. ACM, New York (2002)

    Google Scholar 

  • Taha, W.: Multi-Stage Programming: Its Theory and Applications. PhD thesis, Oregon Graduate Institute of Science and Technology (1999)

    Google Scholar 

  • Universiteit Utrecht. EMGM (2008), http://www.cs.uu.nl/wiki/GenericProgramming/EMGM

  • Wadler, P.: Comprehending monads. In: Proceedings of the 1990 ACM conference on LISP and Functional Programming, LFP 1990, pp. 61–78. ACM, New York (1990)

    Chapter  Google Scholar 

  • Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad-hoc. In: Conference Record of the 16th Annual ACM Symposium on Principles of Programming Languages, pp. 60–76. ACM, New York (1989)

    Google Scholar 

  • Weirich, S.: RepLib: a library for derivable type classes. In: Proceedings of the 2006 ACM SIGPLAN workshop on Haskell, Haskell 2006, pp. 1–12. ACM, New York (2006)

    Chapter  Google Scholar 

  • Yallop, J.: Practical generic programming in OCaml. In: Proceedings of the 2007 workshop on Workshop on ML, ML 2007, pp. 83–94. ACM, New York (2007)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2009 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Jeuring, J., Leather, S., Pedro Magalhães, J., Rodriguez Yakushev, A. (2009). Libraries for Generic Programming in Haskell. In: Koopman, P., Plasmeijer, R., Swierstra, D. (eds) Advanced Functional Programming. AFP 2008. Lecture Notes in Computer Science, vol 5832. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-04652-0_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-04652-0_4

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-04651-3

  • Online ISBN: 978-3-642-04652-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics