Chapter 6. Patterns of Generic Programming
In this chapter, we seek a unified view of "Generic Programming", which comes in many guises; hence the statement,
"Genericity is in the eye of the beholder"
|--Jeremy Gibbons, Datatype-Generic Programming|
We start with a broad perspective by reviewing Jeremy Gibbons' patterns of generic programming—many of which we have already encountered. Then we shift focus to one of the patterns—datatype-generic programming—which is characterized by generic functions parameterized by the shape of the datatype instead of the content.
To get a taste of datatype-generic programming, we'll sample three basic approaches: the sum of products, origami programming, and scrap your boilerplate.
Along the way, we'll encounter ...