Skip to content

panic with GADTs + NoMonomorphismRestriction

The program below causes

ganesh@defoe:~/temp$ ghc -c Test.hs
ghc: panic! (the 'impossible' happened)
  (GHC version 6.10.1 for i386-unknown-linux):
        initC: srt_lbl

with ghc, and

*Test> E 5
ghc: panic! (the 'impossible' happened)
  (GHC version 6.10.1 for i386-unknown-linux):
        nameModule xs{v afT}

with ghci

The problem goes away with ghc -O.

{-# LANGUAGE GADTs, NoMonomorphismRestriction #-}
module Test where

data Expr a = E Int
  deriving Show

data IsSeq a where
   IsSeq :: IsSeq [a]

isSeq :: Expr a -> IsSeq a
isSeq = undefined

mkSeq :: [Expr [a]] -> Expr [a]
mkSeq = undefined

unSeq :: Expr [a] -> [Expr [a]]
unSeq = undefined

sequenceEquality :: Expr a -> Expr a
sequenceEquality x = case isSeq x of
                             IsSeq -> let xs = unSeq x in mkSeq xs
Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ganesh@earth.li
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information