Skip to content

GeneralizedNewtypeDeriving: "deriving ALL"

I've found I've wanted to do:

newtype X1 = X1 ( X ) deriving ( ALL ); newtype X2 = X2 ( X ) deriving ( ALL );

When I want X1, X2 to behave like X, but I might later want to add them to different instances, i.e.

class Silly a

double :: a -> a

instance Silly X1 where

double x = 2 * x

instance Silly X2 where

double x = 3 * x -- Silly double

Currently, it seems to be the only way to do this is to dig into the source of X and find every instance it has. It would be nice to be able to simply to "deriving ALL" to make XN in "newtype XN = XN X" behave exactly the same as X.

Trac metadata
Trac field Value
Version 7.4.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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