Don't suppress warnings in the presence of errors
Consider this fragment of code (uses injective type families, not yet merged into HEAD):
type family Bar a = r | r -> a where
Bar Int = Bool
Bar Bool = Int
Bar Bool = Char
bar :: Bar a -> Bar a
bar x = x
barapp :: Char
barapp = bar 'c'
GHC rejects this with an error:
Couldn't match expected type ‘Bar a0’ with actual type ‘Char’
The type variable ‘a0’ is ambiguous
In the first argument of ‘bar’, namely ‘'c'’
In the expression: bar 'c'
In an equation for ‘barapp’: barapp = bar 'c'
The reason why this is rejected is that the last type family equation is not reachable. GHC warns about that if I comment out barapp
:
Dropping overlapped type family instance equation:
Bar Bool = Char
I believe that with that warning source of the error would be easier to find. So I propose that by default GHC does not suppress warnings in the presence of errors.
Trac metadata
Trac field | Value |
---|---|
Version | 7.11 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |