id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
4128	Can't capture classes inside a template haskell type quotation	lilac		"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."	feature request	new	low	7.6.2	Template Haskell	6.12.1				Unknown/Multiple	Unknown/Multiple	None/Unknown			4230		
