Skip to main content

Generic Views on Data Types

  • Conference paper
Mathematics of Program Construction (MPC 2006)

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

Included in the following conference series:

Abstract

A generic function is defined by induction on the structure of types. The structure of a data type can be defined in several ways. For example, in PolyP a pattern functor gives the structure of a data type viewed as a fixed point, and in Generic Haskell a structural representation type gives an isomorphic type view of a data type in terms of sums of products. Depending on this generic view on the structure of data types, some generic functions are easier, more difficult, or even impossible to define. Furthermore, the efficiency of some generic functions can be improved by choosing a different view. This paper introduces generic views on data types and shows why they are useful. Furthermore, it shows how generic views have been added to Generic Haskell, an extension of the functional programming language Haskell that supports the construction of generic functions. The separation between inductive definitions on type structure and generic views allows us to combine many approaches to generic programming in a single framework.

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

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

    Chapter  Google Scholar 

  2. Hinze, R.: Polytypic values possess polykinded types. Science of Computer Programming 43(2-3), 129–159 (2002)

    Article  MATH  MathSciNet  Google Scholar 

  3. Lämmel, R., Jones, S.P.: Scrap your boilerplate: a practical approach to generic programming. ACM SIGPLAN Notices 38(3), 26–37 (2003); Proceedings ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI 2003)

    Article  Google Scholar 

  4. Jay, C.B.: Distinguishing data structures and functions: the constructor calculus and functorial types. In: Abramsky, S. (ed.) TLCA 2001. LNCS, vol. 2044, pp. 217–239. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  5. Hoogendijk, P., de Moor, O.: Container types categorically. Journal of Functional Programming 10(2), 191–225 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  6. 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)

    Google Scholar 

  7. Jansson, P., Jeuring, J.: A framework for polytypic programming on terms, with an application to rewriting. In: Jeuring, J. (ed.) Workshop on Generic Programming 2000, Ponte de Lima, Portugal, July 2000, pp. 33–45 (2000) Utrecht Technical Report UU-CS-2000-19

    Google Scholar 

  8. 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 

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

    Google Scholar 

  10. Lämmel, R., Peyton Jones, S.: 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 Press, New York (2004)

    Chapter  Google Scholar 

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

    Chapter  Google Scholar 

  12. Wadler, P.: Views: a way for pattern matching to cohabit with data abstraction. In: Conference Record of POPL 1987: The 14th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (1987)

    Google Scholar 

  13. 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 

  14. Malcolm, G.: Data structures and program transformation. Science of Computer Programming 14, 255–279 (1990)

    Article  MATH  MathSciNet  Google Scholar 

  15. Schrage, M.: Proxima, a presentation-oriented editor for structured documents. PhD thesis, Utrecht University (October 2004)

    Google Scholar 

  16. Reynolds, J.C.: Definitional interpreters for higher-order programming languages. In: ACM 1972: Proceedings of the ACM annual conference, pp. 717–740. ACM Press, New York (1972)

    Chapter  Google Scholar 

  17. 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 

  18. Holdermans, S., Jeuring, J., Löh, A., Rodriguez, A.: Generic views on data types. Technical Report UU-CS-2006-020, Department of Information and Computing Sciences, Utrecht University (2006)

    Google Scholar 

  19. Holdermans, S.: Generic views. Master’s thesis, Institute of Information and Computing Sciences, Utrecht University (2005)

    Google Scholar 

  20. Burton, F.W., Cameron, R.D.: Pattern matching with abstract data types. Journal of Functional Programming 3(2), 117–190 (1993)

    Article  MathSciNet  Google Scholar 

  21. Okasaki, C.: Views for Standard ML. In: SIGPLAN Workshop on ML, pp. 14–23 (1998)

    Google Scholar 

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

  23. Abiteboul, S.: On views and XML. In: Proceedings of the 18th ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, pp. 1–9. ACM Press, New York (1999)

    Google Scholar 

  24. Ohori, A., Tajima, K.: A polymorphic calculus for views and object sharing. In: Proceedings of the 13th ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, pp. 255–266 (1994)

    Google Scholar 

  25. Souza dos Santos, C., Abiteboul, S., Delobel, C.: Virtual schemas and bases. In: Jarke, M., Bubenko, J., Jeffery, K. (eds.) EDBT 1994. LNCS, vol. 779, pp. 81–94. Springer, Heidelberg (1994)

    Google Scholar 

  26. Altenkirch, T., McBride, C.: Generic programming within dependently typed programming. In: Gibbons, J., Jeuring, J. (eds.) Generic Programming: IFIP TC2/WG2.1 Working Conference on Generic Programming, Number 115 in International Federation for Information Processing, Dagstuhl, Germany, July 11-12, 2002, pp. 1–20. Kluwer Academic Publishers, Dordrecht (2003)

    Google Scholar 

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

    MATH  MathSciNet  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

Holdermans, S., Jeuring, J., Löh, A., Rodriguez, A. (2006). Generic Views on Data Types. In: Uustalu, T. (eds) Mathematics of Program Construction. MPC 2006. Lecture Notes in Computer Science, vol 4014. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11783596_14

Download citation

  • DOI: https://doi.org/10.1007/11783596_14

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-35631-8

  • Online ISBN: 978-3-540-35632-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics