[GHC] #9880: ghc crashes on th splices in instance context

#9880: ghc crashes on th splices in instance context -------------------------------------+------------------------------------- Reporter: Philonous | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Given Class.hs: {{{#!hs module Class where class Foo a where bar :: a -> Int }}} TH.hs {{{#!hs {-# LANGUAGE TemplateHaskell #-} module TH where import Class import Language.Haskell.TH mkFun :: Q [Dec] mkFun = return [FunD 'bar [Clause [WildP] (NormalB (LitE (IntegerL 0))) []]] }}} and Instance.hs {{{#!hs {-# LANGUAGE TemplateHaskell #-} module Instance where import TH import Class instance Foo Bool where $(mkFun) }}} compiling the project crashes ghc with {{{ #ghc --make Instance.hs [2 of 3] Compiling TH ( TH.hs, TH.o ) [3 of 3] Compiling Instance ( Instance.hs, Instance.o ) ghc: panic! (the 'impossible' happened) (GHC version 7.8.3 for x86_64-unknown-linux): cvBindsAndSigs $[splice{v}]mkFun{v} Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9880 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9880: ghc crashes on th splices in instance context -------------------------------------+------------------------------------- Reporter: Philonous | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * cc: goldfire (added) Comment: HEAD says {{{ T9880.hs:5:3: Declaration splices are allowed only at the top level: $mkFun }}} which is a lot better than crashing. Richard is this supposed to work now? I recall that you largely made splices in local declarations work. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9880#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9880: ghc crashes on th splices in instance context -------------------------------------+------------------------------------- Reporter: Philonous | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by goldfire): The behavior you see -- that error -- is what I'd expect. I had a brief go at implementing local declaration splices but soon realized that implementing this involves quite a bit of replumbing. The splices would have to break up mutually-recursive groups within class, instance, and `let` declarations, and that would require changes to several bits of HsSyn. So, I settled for just fixing the panic and waiting for someone to scream loudly that they need this feature. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9880#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9880: ghc crashes on th splices in instance context -------------------------------------+------------------------------------- Reporter: Philonous | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonpj): Is this behaviour documented in the user manual? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9880#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9880: ghc crashes on th splices in instance context -------------------------------------+------------------------------------- Reporter: Philonous | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by goldfire): Doesn't seem to be. I'll fix that shortly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9880#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9880: ghc crashes on th splices in instance context
-------------------------------------+-------------------------------------
Reporter: Philonous | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.3
Resolution: | Keywords:
Operating System: | Architecture: Unknown/Multiple
Unknown/Multiple | Difficulty: Unknown
Type of failure: | Blocked By:
None/Unknown | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#9880: ghc crashes on th splices in instance context -------------------------------------+------------------------------------- Reporter: Philonous | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: | Version: 7.8.3 Documentation | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => fixed * component: Compiler => Documentation -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9880#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9880: ghc crashes on th splices in instance context -------------------------------------+------------------------------------- Reporter: Philonous | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Documentation | Version: 7.8.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mentheta): Replying to [comment:2 goldfire]:
The behavior you see -- that error -- is what I'd expect.
I had a brief go at implementing local declaration splices but soon realized that implementing this involves quite a bit of replumbing. The splices would have to break up mutually-recursive groups within class, instance, and `let` declarations, and that would require changes to several bits of HsSyn. So, I settled for just fixing the panic and waiting for someone to scream loudly that they need this feature.
Hello goldfire, I've just run into the situation where I hoped `Q [Dec]` would have worked in a let binding, and it did not. I don't yet intend to scream, however, I am curious; Is there any Trac ticket in particular I could subscribe to, where I can follow any potential development on the implementation for supporting declaration splices in let bindings? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9880#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC