Skip to content

deriving for GADTs

I'm pleased to see that GHC 6.12.1 will include deriving for GADTs. However, I discovered this in a quite accidental way. I tried appending deriving (Eq, Show) to the end of my type declaration, without success, and decided to check whether there was a request in Trac for the feature, when I discovered ticket #3012 (closed). Sure enough, switching to a standalone deriving clause worked when I compiled my program in GHC 6.12.1 RC1.

It would be nice if this feature were more easily discoverable. I think it deserves mention in the release notes. Also, it would be great if the error message for the non-standalone deriving clause (Can't make a derived instance of ... / Constructor ... does not have a Haskell-98 type) suggested the standalone syntax.

Trac metadata
Trac field Value
Version 6.12.1 RC1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Documentation
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information