[Haskell-cafe] What instances can be derived by GHC ?
rae at cs.brynmawr.edu
Sat Oct 29 21:36:25 UTC 2016
You've got the complete list, judged by the GHC source code. (There is also Typeable, which can be deprecatedly listed in a `deriving` clause.) I agree that this should be more discoverable. Care to file a documentation ticket so that we put this in the manual?
> On Oct 29, 2016, at 9:31 AM, Jacques Carette <carette at mcmaster.ca> wrote:
> 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' ?
>  http://hackage.haskell.org/package/derive
>  https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GenericDeriving
>  https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/DerivingStrategies
>  http://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/glasgow_exts.html#extensions-to-the-deriving-mechanism
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
More information about the Haskell-Cafe