This adds support for Generics, allowing one to derive Default automagically if using recent enough GHC. This is primarily useful when declaring Default for big records (think database rows, these also often do already have a Generic instance to e.g. derive aesons classes), going especially nice with DeriveAnyClass in GHC 7.10. I've tried to make it is as semantically correct as possible (i.e. not defined it for sum types, as we can't know which one we should use).
The support is made conditional using CPP, so users with other compilers than GHC (or old GHC versions) won't be affected. I've taken GHC 7.6.1 as a lower bound because then we skip depending on anything other than base. Overall this should be zero-impact for all users, while adding Generics support for those who need it.
This adds support for Generics, allowing one to derive
Default
automagically if using recent enough GHC. This is primarily useful when declaringDefault
for big records (think database rows, these also often do already have a Generic instance to e.g. deriveaeson
s classes), going especially nice with DeriveAnyClass in GHC 7.10. I've tried to make it is as semantically correct as possible (i.e. not defined it for sum types, as we can't know which one we should use). The support is made conditional using CPP, so users with other compilers than GHC (or old GHC versions) won't be affected. I've taken GHC 7.6.1 as a lower bound because then we skip depending on anything other thanbase
. Overall this should be zero-impact for all users, while adding Generics support for those who need it.