Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Can't capture classes inside a template haskell type quotation
GHC rejects the following: ``` {-# LANGUAGE TemplateHaskell #-} import Language.Haskell.TH class C a where data X = X fmap return $ instanceD (cxt []) [t| C $(conT ''X) |] [] ``` with the error: ``` test.hs:5:23: Class `C' used as a type In the Template Haskell quotation [t| C $(conT 'X) |] In the second argument of `instanceD', namely `[t| C $(conT 'X) |]' In the expression: instanceD (cxt []) [t| C $(conT 'X) |] [] ``` This is frustrating, since that quotation would have resulted in exactly the TH AST fragment I wanted, had the error not occurred. Instead I must resort to: ``` instanceD (cxt []) (appT (conT ''Storable) (conT ''X)) [] ``` Incidentally, the error message produced is wrong: The error says 'X whereas I wrote ''X. <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ---------------- | | Version | 6.12.1 | | Type | FeatureRequest | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Template Haskell | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"Can't capture classes inside a template haskell type quotation","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":"FeatureRequest","description":"GHC rejects the following:\r\n\r\n{{{\r\n{-# LANGUAGE TemplateHaskell #-}\r\nimport Language.Haskell.TH\r\nclass C a where\r\ndata X = X\r\nfmap return $ instanceD (cxt []) [t| C $(conT ''X) |] []\r\n}}}\r\n\r\nwith the error:\r\n\r\n{{{\r\ntest.hs:5:23:\r\n Class `C' used as a type\r\n In the Template Haskell quotation [t| C $(conT 'X) |]\r\n In the second argument of `instanceD', namely `[t| C $(conT 'X) |]'\r\n In the expression: instanceD (cxt []) [t| C $(conT 'X) |] []\r\n}}}\r\n\r\nThis is frustrating, since that quotation would have resulted in exactly the TH AST fragment I wanted, had the error not occurred. Instead I must resort to:\r\n\r\n{{{\r\ninstanceD (cxt []) (appT (conT ''Storable) (conT ''X)) []\r\n}}}\r\n\r\nIncidentally, the error message produced is wrong: The error says 'X whereas I wrote ''X.","type_of_failure":"OtherFailure","blocking":[]} -->
issue