#6005: Template Haskell disallows use of promoted data constructor in same splice ---------------------------------------+------------------------------------ Reporter: goldfire | Owner: Type: bug | Status: new Priority: normal | Component: Template Haskell Version: 7.5 | Keywords: DataKinds PolyKinds Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Testcase: Blockedby: | Blocking: Related: | ---------------------------------------+------------------------------------ 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. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6005> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs