Recursive default associated types don't kind-generalize properly
When I say
{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, UndecidableInstances #-}
module Bug where
import Data.Proxy
class PEnum (kproxy :: KProxy a) where
type ToEnum (x :: a) :: Bool
type ToEnum x = TEHelper
type TEHelper = ToEnum Int
I get
/Users/rae/temp/Bug.hs:11:24:
The first argument of ‘ToEnum’ should have kind ‘a’,
but ‘Int’ has kind ‘*’
In the type ‘ToEnum Int’
In the type declaration for ‘TEHelper’
I believe my original code should kind-check, as ToEnum
should be applicable to any kind.
My guess is that this sort of recursion isn't properly accounted for in the kind-checking algorithm in !TcTyClsDecls, and that we kind-check TEHelper
before ToEnum
is kind-generalized.
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |