I found an interesting situation, when using data kinds with type families.
The compiler's error message is No instance for (C (ID ())) arising from a use of W
. It suggests that a type family application is not fully evaluated, even when it is saturated. :kind! ID ()
evaluates to ()
, so according to the C ()
instance should be used.
{-# LANGUAGE GADTs, TypeFamilies, UndecidableInstances, FlexibleContexts #-}
type family ID t where
ID t = t
class C t where
instance C () where
data W where
W :: C (AppID t) => P t -> W
type family AppID t where
AppID t = (ConstID t) ()
type family ConstID t where
ConstID t = ID
data P t where
P :: P t
data A
w :: W
w = W (P :: P A)
Could I somehow force the evaluation of ID ()
? Is it a compiler bug?
I'm using GHC 7.8.3
The problem is the kind of ConstID
.
type family ConstID t a where
ConstID t a = ID a
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With