Ticket #6005 (closed bug: fixed)
Template Haskell disallows use of promoted data constructor in same splice
Description
The following code fails to compile under GHC 7.5.20120413:
{-# LANGUAGE TemplateHaskell, DataKinds, PolyKinds #-}
$( [d|
data Nat = Zero | Succ Nat
data Proxy a = Proxy
foo :: Proxy Zero
foo = Proxy
|])
The error is:
The exact Name `Zero_a3N3' is not in scope Probable cause: you used a unique name (NameU), perhaps via newName, in Template Haskell, but did not bind it If that's it, then -ddump-splices might be useful
Using -ddump-splices shows that the same internal name is used for the data constructor at declaration and usage.
The problem seems to be that a data constructor declared within a splice cannot be used as a promoted type in that same splice. Separating the splices works.
Change History
Note: See
TracTickets for help on using
tickets.
