Deriving Generic1 interacts poorly with TypeInType
Vanilla datatypes and data family instances are still inconsistent w.r.t. which type variables are considered "instantiated" in a
Generic1 instance. For instance, this is rejected:
λ> data Proxy k (a :: k) = ProxyCon deriving Generic1
<interactive>:32:43: error: • Can't make a derived instance of ‘Generic1 (Proxy *)’: Proxy must not be instantiated; try deriving `Proxy k a' instead • In the data declaration for ‘Proxy’
And rightfully so, since the visible kind binder
k is instantiated to
*. But now it's possible to have an equivalent instance for a data family that squeaks past this check!
λ> data family ProxyFam (a :: y) (b :: z) λ> data instance ProxyFam k (a :: k) = ProxyFamCon deriving Generic1 ==================== Derived instances ==================== Derived instances: instance GHC.Generics.Generic1 (Ghci13.ProxyFam *) where ...
[Ryan needs] to investigate further to see why this is the case.