Deriving Generic1 interacts poorly with TypeInType
From \@RyanGlScott, [ticket:11357\#comment:117922](https://gitlab.haskell.org//ghc/ghc/issues/11357#note_117922):
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.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Deriving Generic1 interacts poorly with TypeInType","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.1","keywords":["Generics","TypeInType,"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"From @RyanGlScott, comment:9:ticket:11357:\r\n\r\nVanilla 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:\r\n\r\n{{{\r\nλ> data Proxy k (a :: k) = ProxyCon deriving Generic1\r\n}}}\r\n\r\n{{{\r\n<interactive>:32:43: error:\r\n • Can't make a derived instance of ‘Generic1 (Proxy *)’:\r\n Proxy must not be instantiated; try deriving `Proxy k a' instead\r\n • In the data declaration for ‘Proxy’\r\n}}}\r\n\r\nAnd 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!\r\n\r\n{{{\r\nλ> data family ProxyFam (a :: y) (b :: z)\r\nλ> data instance ProxyFam k (a :: k) = ProxyFamCon deriving Generic1\r\n\r\n==================== Derived instances ====================\r\nDerived instances:\r\n instance GHC.Generics.Generic1 (Ghci13.ProxyFam *) where\r\n ...\r\n}}}\r\n\r\n[Ryan needs] to investigate further to see why this is the case. ","type_of_failure":"OtherFailure","blocking":[]} -->
issue