[Haskell-cafe] What instances can be derived by GHC ?
carette at mcmaster.ca
Sat Oct 29 13:31:54 UTC 2016
I am trying to find a list of classes which can be derived 'out of the
box' with GHC 8.0, i.e. without installing extra packages like derive
. There is quite a lot of information on how 'deriving' (inline and
standalone) works  on the GHC wiki, but sadly no list. Yes, it does
say that any class could be made derivable, but that's not useful, as it
doesn't which ones have been. The page describing DerivingStrategies
does have a list of 'stock classes' - is this indeed the full list?
From the 8.0.1 documentation on Deriving , one can extract a list too.
For reference, as far as I can tell, the answer to my question *appears
to be* (using extensions as necessary):
- Bounded, Enum, Eq, Ix, Ord, Read, Show, Functor, Foldable,
Traversable, Generic, Generic1, Data, Lift.
I do understand that GeneralizedNewtypeDeriving muddies the water.
Let's ignore 'newtype' for this purpose, and only concentrate on 'data'.
If my guess is correct, would it make sense to put this information
somewhere easy to find, instead of having be buried, so that it needs to
be 'dug out' ?
More information about the Haskell-Cafe