Summary
Type classes are an essential building block for nearly all large Haskell applications. You’ll use them extensively throughout the rest of the book, and they will be common in both library and application code that you encounter. Unlike parametric polymorphism, you should be judicious in your use of type classes. Most large applications and libraries will introduce a few new type classes, but only a few. Overuse of type classes in your application can be a cause of excess abstraction that makes your program more difficult to work with and reason about, rather than easier.
Well-designed type classes should be narrowly focused on a specific feature, and will generally only define a small handful of functions. It’s common to have type classes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access