Kind inference does not propagate annotations on associated types
Consider the following:
{-# LANGUAGE KindSignatures, TypeFamilies, PolyKinds #-}
data Proxy a = Proxy
class C a where
type F (a :: *) :: *
op :: Proxy a -> Int
instance C [] where
op _ = 5
When compiled, this code generates a warning saying that F []
is undefined. That's a good warning, but the problem is that the code is erroneous and should not compile. The problem is that the kind annotation on a
in the declaration of the family F
says that a
should have kind *
. However, I am permitted to write an instance for []
, which does not have kind *
.
After playing around with this, I was unable to find a way to cause a type safety error, but the behavior should probably be fixed.
Trac metadata
Trac field | Value |
---|---|
Version | 7.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |