id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
5037	TH mkName bug	igloo		"This is accepted:
{{{
{-# LANGUAGE TemplateHaskell #-}

import Language.Haskell.TH

f :: Maybe Int -> Int
f Nothing = 3
f (Just x) = $(varE (mkName ""x""))
}}}
but this fails:
{{{
{-# LANGUAGE TemplateHaskell #-}

import Language.Haskell.TH

$( do ds <- [d|
                f :: Maybe Int -> Int
                f Nothing = 3
                f (Just x) = $(varE (mkName ""x""))
              |]
      runIO $ putStrLn $ pprint ds
      return ds )
}}}
with:
{{{
f :: Data.Maybe.Maybe GHC.Types.Int -> GHC.Types.Int
f (Data.Maybe.Nothing) = 3
f (Data.Maybe.Just x_0) = x

q.hs:5:4: Not in scope: `x'
}}}
I expect it to be accepted.
"	bug	closed	normal	7.4.1	Template Haskell	7.0.2	fixed			Unknown/Multiple	Unknown/Multiple	None/Unknown		th/T5037			
