GHC panic
I get
$ ./ghc-stage2 -ignore-dot-ghci --interactive /tmp/tEZm.hs
GHCi, version 8.1.20160930: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /tmp/tEZm.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.1.20160930 for x86_64-unknown-linux):
kindPrimRep.go
rep_a13E
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1076:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1080:37 in ghc:Outputable
pprPanic, called at compiler/simplStg/RepType.hs:369:9 in ghc:RepType
kindPrimRep, called at compiler/simplStg/RepType.hs:337:18 in ghc:RepType
typePrimRep, called at compiler/ghci/ByteCodeGen.hs:1541:15 in ghc:ByteCodeGen
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
running
{-# Language MagicHash, PolyKinds, ViewPatterns, TypeInType, RebindableSyntax, NoImplicitPrelude #-}
import GHC.Types
import Prelude hiding (Num (..))
import qualified Prelude as P
import GHC.Prim
data BoxUnbox = BUB Int Int#
class Num (a :: TYPE rep) where
(+) :: a -> a -> a
fromInteger :: Integer -> a
instance Num Int where
(+) = (P.+)
fromInteger = P.fromInteger
instance Num Int# where
(+) = (+#)
fromInteger (fromInteger -> I# n) = n
a :: BoxUnbox
a = let u :: Num (a :: TYPE rep) => a
u = 1 + 2 + 3 + 4
in
BUB u u
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |