Kind inference fails to account for associated types
Consider this:
{-# LANGUAGE PolyKinds, TypeFamilies, FlexibleInstances #-}
class C a where
type F a
instance C a where
type F a = a -> a
HEAD gives me
Expected a type, but ‛a’ has kind ‛k’
In the type ‛a -> a’
In the type instance declaration for ‛F’
In the instance declaration for ‛C a’
The problem is that the use of (->)
in the RHS of the definition for the F a
instance constrains a
to be of kind *
, but GHC does not propagate this information back to the instance head. This decision is in conflict with the behavior for class declarations (as opposed to instance declarations), where a type variable's use in the definition informs its kind in the head.
Trac metadata
Trac field | Value |
---|---|
Version | 7.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |