This chapter covers:
- Haskell features to support deriving type classes instances automatically
- Exploiting a generic representation for any datatype to write a datatype-generic code
- Generating code at compile time with Template Haskell
When we write code in Haskell, we call it programming. When we write code that generates or processes other code on our behalf, we call it metaprogramming, or generative programming. With metaprogramming techniques, we usually automate repetitive boilerplate code, which is too dull to write manually. This leads to boosting developer productivity. Sometimes, there is a price to pay. Such a code can be quite hard to write and maintain.