TH mkName bug
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.
Trac metadata
Trac field | Value |
---|---|
Version | 7.0.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |