|
#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 [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
#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: | ---------------------------------------+------------------------------------ Comment(by simonpj@…): commit 2a1190431218f838797be3c09084e22dc131c58a {{{ Author: Simon Peyton Jones <[hidden email]> Date: Wed Apr 25 12:55:41 2012 +0100 Fix looking up of Exact RdrNames, fixes Trac #6005 See Note [Splicing Exact names] in RnEnv. compiler/rename/RnEnv.lhs | 43 ++++++++++++++++++++++++++++++++++--------- 1 files changed, 34 insertions(+), 9 deletions(-) }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6005#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6005: Template Haskell disallows use of promoted data constructor in same splice
----------------------------------------+----------------------------------- Reporter: goldfire | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Template Haskell | Version: 7.5 Resolution: fixed | Keywords: DataKinds PolyKinds Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Difficulty: Unknown Testcase: th/T6005 | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Changes (by simonpj): * status: new => closed * difficulty: => Unknown * resolution: => fixed * testcase: => th/T6005 Comment: Thanks for pointing me to this. Fixed. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6005#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6005: Template Haskell disallows use of promoted data constructor in same splice
----------------------------------------+----------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.5 Resolution: | Keywords: DataKinds PolyKinds Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Difficulty: Unknown Testcase: th/T6005 | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Changes (by goldfire): * status: closed => new * resolution: fixed => Comment: Thanks for applying this fix. Unfortunately, the following case still fails: {{{ $( [d| data Nat = Zero | Succ Nat deriving Show data Proxy a = Proxy foo :: Proxy Zero foo = Proxy |]) }}} The only difference between this case and the original is the {{{deriving Show}}}. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6005#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6005: Template Haskell disallows use of promoted data constructor in same splice
----------------------------------------+----------------------------------- Reporter: goldfire | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Template Haskell | Version: 7.5 Resolution: fixed | Keywords: DataKinds PolyKinds Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Difficulty: Unknown Testcase: th/T6005, T6005a | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Changes (by simonpj): * status: new => closed * testcase: th/T6005 => th/T6005, T6005a * resolution: => fixed Comment: This turns out to be unrelated to data kinds etc. Instead it is simply to do with the difficulty of type-checking Template Haskell brackets, something that led me to propose a [http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal complete overhaul] (not yet done). In this case we are generating the derived code for the bracket when we typecheck the bracket. This is silly because it's sure to type check; and it goes wrong too for reasons that are not intersting. I have brutally simply suppressed all 'deriving' processing inside TH brackets. It'll all become irrelevant with the overhaul. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6005#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6005: Template Haskell disallows use of promoted data constructor in same splice
----------------------------------------+----------------------------------- Reporter: goldfire | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Template Haskell | Version: 7.5 Resolution: fixed | Keywords: DataKinds PolyKinds Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Difficulty: Unknown Testcase: th/T6005, T6005a | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Comment(by simonpj@…): commit d50cb3eda3912df0d75a8177f04783689b21dc9b {{{ Author: Simon Peyton Jones <[hidden email]> Date: Thu Apr 26 13:47:54 2012 +0100 Do not generate derived instances in TH brackets See Note [Deriving inside TH brackets] in TcInstDcls Fixes Trac #6005 (again) compiler/typecheck/TcInstDcls.lhs | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-) }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6005#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
| Powered by Nabble | Edit this page |
