Reloading GHCi with Template Haskell names can panic GHC
First, load the following program into GHCi.
Fun.hs
module Fun where
import Language.Haskell.TH
stuff = do
-- let x = mkName "X"
x <- newName "X"
sequence $ [dataD (return []) x [] [
normalC x []
] []]
thbug.hs
{-# LANGUAGE TemplateHaskell #-}
import Fun
stuff
Then comment out the newName, un comment the mkName and reload GHCi.
ghc: panic! (the 'impossible' happened)
(GHC version 7.8.3 for x86_64-apple-darwin):
kcLookupKind APromotionErr RecDataConPE
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
It is important to note this is a valid program, if you then close GHCi and start it again with the modified file, it will load correctly. Reloading after attempting to compile the newName version will cause a panic.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |