Newtype derving used wrongly
Emil Axelsson reports: I attach a program Test.hs
which I suspect demonstrates a bug in GHC. The important lines are:
showType :: forall a . Expr a -> String
showType (Lit _) = show (typeOf (undefined :: a))
test1 = showType (mk :: Expr BOOL) -- Prints "Bool" (wrong?)
test2 = showType (Lit mk :: Expr BOOL) -- Prints "Main.BOOL" (correct)
test1
and test2
give different results, even though showType shouldn't be able to tell them apart. It seems that the Typeable
context packed with the Lit constructor is wrong in test2
.
Trac metadata
Trac field | Value |
---|---|
Version | 7.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | emax@chalmers.se |
Operating system | |
Architecture |