|Version 3 (modified by malcolm.wallace@…, 9 years ago) (diff)|
Automatic derivation of instances is jolly useful. Current problems are:
- Automatic derivation is only available for certain classes defined in the Prelude and standard libraries.
- There is no way to specify how to derive a user-defined class in the general case.
- There is no way to derive an instance of a class for a data type that is defined elsewhere (in another module).
- There is no easy way to refer to the definitions that would have been derived when defining an explicit instance.
- Deriving fails for some Haskell-98 data types. Try
data Rose f a = Fork a (f (Rose f a)) deriving Showas an example.
- Even in the absence of user-defined deriving, it should be easy for a 'newtype' decl to inherit some of the instances of its parent type, no matter where the class was defined, but this is currently only available as a ghc extension to haskell'98.
There are various extant proposals to enable the user-specification of the derivation of class instances.