-Wredundant-constraints doesn't factor in associated type families
If I compile this code:
{-# LANGUAGE TypeFamilies #-}
module M where
class C a where
type T a
instance C a => C [a] where
type T [a] = T a
with -Wredundant-constraints
enabled, it complains:
$ /opt/ghc/head/bin/ghc -Wredundant-constraints M.hs
[1 of 1] Compiling M ( M.hs, M.o )
M.hs:7:10: warning: [-Wredundant-constraints]
• Redundant constraint: C a
• In the instance declaration for ‘C [a]’
I don't think this is right. The RHS of T [a]
won't be able to reduce unless there's a T a
instance available–that is, unless there's a C a
instance available, which is what the context provides, making it non-redundant.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | simonpj |
Operating system | |
Architecture |