Deriving More Things

The standard deriving mechanism in Haskell is quite useful but limited, which is why GHC has introduced several language extensions to make deriving more powerful and useful in more circumstances. In this section, you’ll learn about a few of them that have the largest impact on the way you approach writing code. Throughout this book, you’ll learn about others that are useful but less drastic in how they shape the way you approach writing your programs.

Deriving in Newtypes with Generalized Newtype Deriving

One of the first limitations that you’ll run into with deriving in type classes is the problem of having a limited number of type classes that you’re allowed to derive instances for. It makes sense that you might not be ...

Get Effective Haskell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.