Summary

This chapter started with a high-level discussion of the patterns of generic programming.

In the remainder of the chapter, we explored three variations of datatype-generic programming, that is, three techniques of parameterizing generic functions by data shape rather than by contents.

Underlying these varied approaches were some common threads:

  • To achieve generic functions, we need "generic data" (in the form of a universal type representation)
  • Datatype-generic programming mixes well with more rudimentary meta-programming (for example, when we autoderived Typeable instances in the process of writing generic functions)
  • using "shallow recursion" on a lower layer allows us to express all manner of recursive functions on the higher level

Generic Programming relies on extensions to the Haskell Type system. In the following Chapter 7, Patterns of Kind Abstraction we will see that we can raise the level of abstraction even further via extensions to the Kind system!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset