GHC rejects instance quotations with splices in the instance head
I think the following code should be accepted.
```
{-# LANGUAGE TemplateHaskell #-}
class Storable a where
data X = X
[d| instance Storable $( [t| X |] ) where |]
```
GHC disagrees, saying:
```
test.hs:4:4:
Illegal instance declaration for `Storable t_aKj'
(All instance types must be of the form (T a1 ... an)
where a1 ... an are type *variables*,
and each type variable appears at most once in the instance head.
Use -XFlexibleInstances if you want to disable this.)
In the instance declaration for `Storable $[t| X |]'
In the Template Haskell quotation
[d|
instance Storable $[t| X |] where |]
In the expression:
[d|
instance Storable $[t| X |] where |]
```
This checking seems inappropriate before the type is actually spliced in!
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 6.12.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC rejects instance quotations with splices in the instance head","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.12.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I think the following code should be accepted.\r\n\r\n{{{\r\n{-# LANGUAGE TemplateHaskell #-}\r\nclass Storable a where\r\ndata X = X\r\n[d| instance Storable $( [t| X |] ) where |]\r\n}}}\r\n\r\nGHC disagrees, saying:\r\n\r\n{{{\r\ntest.hs:4:4:\r\n Illegal instance declaration for `Storable t_aKj'\r\n (All instance types must be of the form (T a1 ... an)\r\n where a1 ... an are type *variables*,\r\n and each type variable appears at most once in the instance head.\r\n Use -XFlexibleInstances if you want to disable this.)\r\n In the instance declaration for `Storable $[t| X |]'\r\n In the Template Haskell quotation\r\n [d| \r\n instance Storable $[t| X |] where |]\r\n In the expression:\r\n [d| \r\n instance Storable $[t| X |] where |]\r\n}}}\r\n\r\nThis checking seems inappropriate before the type is actually spliced in!","type_of_failure":"OtherFailure","blocking":[]} -->
issue