Generalized newtype deriving
When you define a type using the
newtype X = X Y
you are defining a new type
X is representationally equivalent to
Y, but nominally different; although
Y have the same representation, they are different types. This means that they can have different typeclass instances.
Often, however, you want typeclass instances for a newtype that are exactly the same as the instances of the underlying type. The
GeneralizedNewtypeDeriving GHC extension provides a convenient way to do that.