|
#7016: Declarations after top-level splice are ignored
---------------------------------------+------------------------------------ Reporter: Oblosys | Owner: Type: bug | Status: new Priority: normal | Component: Template Haskell Version: 7.4.2 | Keywords: Os: MacOS X | Architecture: x86_64 (amd64) Failure: GHC rejects valid program | Testcase: Blockedby: | Blocking: Related: | ---------------------------------------+------------------------------------ Declarations that appear after a top-level splice seem to be ignored without any warning. In the attached Main, the identifier afterSplice is not recognized: {{{ Main.hs:6:11: Not in scope: `afterSplice' }}} The error disappears if the declaration of afterSplice is put before dummySplice, or if the declaration for problem is removed (in which case afterSplice is declared correctly, as can be seen with in ghci.) I could track the problem back to at least ghc-7.0.4. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7016> 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 |
|
#7016: Declarations after top-level splice are ignored
----------------------------------------+----------------------------------- Reporter: Oblosys | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Template Haskell | Version: 7.4.2 Resolution: invalid | Keywords: Os: MacOS X | Architecture: x86_64 (amd64) Failure: GHC rejects valid program | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Changes (by simonpj): * status: new => closed * difficulty: => Unknown * resolution: => invalid Comment: This is by design, as described in Section 7.2 of the original [http://research.microsoft.com/en-us/um/people/simonpj/papers/meta-haskell /meta-haskell.pdf Template Haskell paper]. I agree it's not ideal, but it's not accidental, and I don't know of a better way. Hmm. It may be that some of the changes mooted in my [http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal New directions for Template Haskell] post (which I plan to work in on August) may change this. Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7016#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
#7016: Declarations after top-level splice are ignored
----------------------------------------+----------------------------------- Reporter: Oblosys | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Template Haskell | Version: 7.4.2 Resolution: invalid | Keywords: Os: MacOS X | Architecture: x86_64 (amd64) Failure: GHC rejects valid program | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Comment(by Oblosys): Ah, so it's a feature! :-) Perhaps this could be briefly mentioned in the documentation? (right after the quieter and less intimidating example). I thought it was a bug because I couldn't find it there and the error message didn't mention Template Haskell. It's just a small issue, but since I use TH to derive type classes for data declarations, the most appropriate place for the splice would be close to the data declaration. (Each data type is also accompanied by a function declaration, which causes the scoping issues.) I will await the changes from the new directions post! -- Martijn -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7016#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 |
| Powered by Nabble | Edit this page |
