Skip to content

typecheck/TcTyClsDecls.lhs: Non-exhaustive patterns in function tcConDecl

The following code

module Main where

newtype Test where
    T :: Int -> Test

instance Show Test where
    show (T i) = show i

main = putStrLn (show (T 3))

causes the compiler to crash with:

[1 of 1] Compiling Main             ( test2.hs, test2.o )
ghc-6.6: panic! (the 'impossible' happened)
  (GHC version 6.6 for powerpc-apple-darwin):
        typecheck/TcTyClsDecls.lhs:(468,0)-(524,4): Non-exhaustive patterns in function tcConDecl


Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

however changing 'newtype' to 'data' compiles without errors.

Tested with GHC and GHCi 6.6 under Mac OS X 10.4.8 running on an iMac G5.

Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information