Ticket #5037 (closed bug: fixed)
TH mkName bug
| Reported by: | igloo | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.4.1 |
| Component: | Template Haskell | Version: | 7.0.2 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | |
| Test Case: | th/T5037 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
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.
Change History
Note: See
TracTickets for help on using
tickets.
