Skip to main content

Chapter 2. Generic Haskell: Applications

  • Chapter
Generic Programming

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

Abstract

Generic Haskell is an extension of Haskell that supports the construction of generic programs. These lecture notes discuss three advanced generic programming applications: generic dictionaries, compressing XML documents, and the zipper: a data structure used to represent a tree together with a subtree that is the focus of attention, where that focus may move left, right, up or down the tree. When describing and implementing these examples, we will encounter some advanced features of Generic Haskell, such as type-indexed data types, dependencies between and generic abstractions of generic functions, adjusting a generic function using a default case, and generic functions with a special case for a particular constructor.

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 49.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. Abott, M., Altenkirch, T., Ghani, N., McBride, C.: Derivatives of containers. In: Hofmann, M.O. (ed.) TLCA 2003. LNCS, vol. 2701, pp. 16–30. Springer, Heidelberg (2003) (to appear)

    Google Scholar 

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

  3. Bird, R., Gibbons, J.: Arithmetic coding with folds and unfolds. In: Jeuring, J., Jones, S.L.P. (eds.) AFP 2002. LNCS, vol. 2638, Springer, Heidelberg (2003) (to appear)

    Google Scholar 

  4. Cameron, R.D.: Source encoding using syntactic information source models. IEEE Transactions on Information Theory 34(4), 843–850 (1988)

    Article  Google Scholar 

  5. Cannataro, M., Carelli, G., Pugliese, A., Sacca, D.: Semantic lossy compression of XML data. In: Knowledge Representation Meets Databases (2001)

    Google Scholar 

  6. Cheney, J.: Compressing xml with multiplexed hierarchical models. In: Proceedings of the 2001 IEEE Data Compression Conference, DCC 2001, pp. 163–172 (2001)

    Google Scholar 

  7. Claessen, K., Runciman, C., Chitil, O., Hughes, J., Wallace, M.: Testing and tracing lazy functional programs using Quickcheck and Hat. In: Jeuring, J., Jones, S.L.P. (eds.) AFP 2002. LNCS, vol. 2638, Springer, Heidelberg (2003) (to appear)

    Chapter  Google Scholar 

  8. Clarke, D.: Towards GH(XML). Talk at the Generic Haskell meeting (2001), see, http://www.generic-haskell.org/talks.html

  9. Clarke, D., Hinze, R., Jeuring, J., Löh, A., de Wit, J.: The Generic Haskell user’s guide. Technical Report UU-CS-2001-26, Utrecht University (2001), Also available from http://www.generic-haskell.org/

  10. Clarke, D., Löh, A.: Generic Haskell, specifically. In: Gibbons, J., Jeuring, J. (eds.) Generic Programming, January 2003. IFIP, vol. 243, pp. 21–48. Kluwer Academic Publishers, Dordrecht (2003)

    Google Scholar 

  11. Connelly, R.H., Morris, F.L.: A generalization of the trie data structure. Mathematical Structures in Computer Science 5(3), 381–418 (1995)

    Article  MATH  MathSciNet  Google Scholar 

  12. XMLSolutions Corporation. XMLZip (1999), Available from http://www.xmlzip.com/

  13. de la Briandais, R.: File searching using variable length keys. In: Proc. Western Joint Computer Conference, vol. 15, pp. 295–298. AFIPS Press (1959)

    Google Scholar 

  14. Evans, W.S., Fraser, C.W.: Bytecode compression via profiled grammar rewriting. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 148–155 (2001)

    Google Scholar 

  15. Franz, M.: Adaptive compression of syntax trees and iterative dynamic code optimization: Two basic technologies for mobile object systems. In: Mobile Object Systems: Towards the Programmable Internet, pp. 263–276. Springer, Heidelberg (1997)

    Google Scholar 

  16. Girardot, M., Sundaresan, N.: Millau: an encoding format for efficient representation and exchange of XML over the Web. In: IEEE International Conference on Multimedia and Expo (I) 2000, pp. 747–765 (2000)

    Google Scholar 

  17. Hagg, P.: A framework for developing generic XML Tools. Master’s thesis, Department of Information and Computing Sciences, Utrecht University (2002)

    Google Scholar 

  18. Hinze, R.: Generalizing generalized tries. Journal of Functional Programming 10(4), 327–351 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  19. Hinze, R.: Generic Programs and Proofs, Habilitationsschrift, Bonn University (2000)

    Google Scholar 

  20. Hinze, R.: A new approach to generic functional programming. In: Conference Record of POPL 2000: The 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 119–132. ACM Press, New York (2000)

    Google Scholar 

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

    Article  MATH  MathSciNet  Google Scholar 

  22. Hinze, R., Jeuring, J.: Generic Haskell: practice and theory, (2003) (to appear)

    Google Scholar 

  23. Hinze, R., Jeuring, J., Löh, A.: Type-indexed data types. In: Boiten, E.A., Möller, B. (eds.) MPC 2002. LNCS, vol. 2386, pp. 148–174. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  24. Huet, G.: The zipper. Journal of Functional Programming 7(5), 549–554 (1997)

    Article  MATH  MathSciNet  Google Scholar 

  25. INC Intelligent Compression Technologies. XML-Xpress. (2001), Whitepaper available from http://www.ictcompress.com/products_xmlxpress.html

  26. Jansson, P., Jeuring, J.: Polytypic compact printing and parsing. In: Swierstra, S.D. (ed.) ESOP 1999. LNCS, vol. 1576, pp. 273–287. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  27. Jansson, P.: The WWW home page for polytypic programming (2001), Available from http://www.cs.chalmers.se/~patrikj/poly/

  28. Jansson, P., Jeuring, J.: Functional pearl: Polytypic unification. Journal of Functional Programming 8(5), 527–536 (1998)

    Article  MATH  MathSciNet  Google Scholar 

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

  30. Jansson, P., Jeuring, J.: Polytypic data conversion programs. Science of Computer Programming 43(1), 35–75 (2002)

    Article  MATH  MathSciNet  Google Scholar 

  31. Jeuring, J.: Polytypic pattern matching. In: Conference Record of FPCA 1995, SIGPLAN-SIGARCH-WG2.8 Conference on Functional Programming Languages and Computer Architecture, pp. 238–248. ACM Press, New York (1995)

    Google Scholar 

  32. Jeuring, J., Hagg, P.: XComprez (2002), Available from http://www.generic-haskell.org/xmltools/XComprez/

  33. Knuth, D.E.: The Art of Computer Programming, Volume 3: Sorting and Searching, 2nd edn. Addison-Wesley Publishing Company, Reading (1998)

    Google Scholar 

  34. Koopman, P., Alimarine, A., Tretmans, J., Plasmeijer, R.: Gast: Generic automated software testing. Submitted for publication (2002)

    Google Scholar 

  35. Lämmel, R., Jones, S.P.: Scrap your boilerplate: a practical approach to generic programming. In: Proc. ACM SIGPLAN Workshop on Types in Language Design and Implementation, TLDI 2003 (2003)

    Google Scholar 

  36. Liefke, H., Suciu, D.: XMill: an efficient compressor for XML data. In: Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data, pp. 153–164 (2000)

    Google Scholar 

  37. Löh, A., Clarke, D., Jeuring, J.: Generic Haskell, naturally: The language and its type system (2003) (in preparation)

    Google Scholar 

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

    Article  MATH  MathSciNet  Google Scholar 

  39. McBride, C.: The derivative of a regular type is its type of one-hole contexts (2001) (unpublished manuscript)

    Google Scholar 

  40. Meertens, L.: Paramorphisms. Formal Aspects of Computing 4(5), 413–425 (1992)

    Article  MATH  Google Scholar 

  41. Meertens, L.: Functor pulling. In: Workshop on Generic Programming (WGP 1998), Marstrand, Sweden (June 1998)

    Google Scholar 

  42. Meijer, E., Fokkinga, M.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 

  43. Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)

    Book  Google Scholar 

  44. Okasaki, C., Gill, A.: Fast mergeable integer maps. In: The 1998 ACM SIGPLAN Workshop on ML, Baltimore, Maryland, pp. 77–86 (1998)

    Google Scholar 

  45. Jones, S.P., Hughes, J., Augustsson, L., Barton, D., Boutel, B., Burton, W., Fraser, S., Fasel, J., Hammond, K., Hinze, R., Hudak, P., Johnsson, T., Jones, M., Launchbury, J., Meijer, E., Peterson, J., Reid, A., Runciman, C., Wadler, P.: Haskell 1998 — A non-strict, purely functional language (February 1999), Available from http://www.haskell.org/definition/

  46. Stork, C.H., Haldar, V.V., Franz, M.: Generic adaptive syntax-directed compression for mobile code. Technical Report 00-42, Department of Information and Computer Science, University of California, Irvine (2000)

    Google Scholar 

  47. Thue, A.: Über die gegenseitige lage gleicher teile gewisser zeichenreihen. Skrifter udgivne af Videnskaps-Selskabet i Christiania, Mathematisk-Naturvidenskabelig Klasse 1, 1–67 (1912); Reprinted in Thue’s Selected Mathematical Papers, pp. 413–477. Universitetsforlaget, Oslo (1977)

    Google Scholar 

  48. Tolani, P., Haritsa, J.R.: XGRIND: A query-friendly XML compressor. In: ICDE (2002)

    Google Scholar 

  49. W3C. XML 1.0 (1998), Available from http://www.w3.org/XML/

  50. Wadsworth, C.P.: Recursive type operators which are more than type schemes. Bulletin of the EATCS 8, 87–88 (1979); Abstract of a talk given at the 2nd International Workshop on the Semantics of Programming Languages, Bad Honnef, Germany, March 19–23 (1979)

    Google Scholar 

  51. Wallace, M., Runciman, C.: Haskell and XML: Generic combinators or type-based translation? In: International Conference on Functional Programming, pp. 148–159 (1999)

    Google Scholar 

  52. Ziv, J., Lempel, A.: A universal algorithm for sequential data compression. IEEE Transactions on Information Theory 23(3), 337–343 (1977)

    Article  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

© 2003 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Hinze, R., Jeuring, J. (2003). Chapter 2. Generic Haskell: Applications. In: Backhouse, R., Gibbons, J. (eds) Generic Programming. Lecture Notes in Computer Science, vol 2793. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-45191-4_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-45191-4_2

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-20194-6

  • Online ISBN: 978-3-540-45191-4

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics