How to derive Generic for (some) GADTs using QuantifiedConstraints

The Generic and Generic1 classes are extremely useful tools in a GHC programmer’s toolbox, but their utility is currently limited in the sense that one can only derive Generic instances for simple data types. By “simple”, I mean that GHC will simply error if you try to derive Generic a more sophisticated data type—a GADT—like this one:

Continue reading »

Improvements to deriving in GHC 8.2

We’re drawing closer to a release of GHC 8.2, which will feature a variety of enhancements to GHC’s deriving-related extensions. None of the improvements are particularly revolutionary, and for most code, you won’t notice a difference. But there are quite a few quality-of-life fixes that should make doing certain things with deriving a little less of a hassle.

Continue reading »
Top