Kind variable generalization error in GADTs
The following code fails to compile with 7.5.20120426:
{-# LANGUAGE DataKinds, KindSignatures, PolyKinds, GADTs, ExistentialQuantification #-}
data SMaybe :: (k -> *) -> Maybe k -> * where
SNothing :: forall (s :: k -> *). SMaybe s Nothing
SJust :: forall (s :: k -> *) (a :: k). s a -> SMaybe s (Just a)
The reported error is
Kind mis-match
The first argument of `SMaybe' should have kind `k1 -> *',
but `s' has kind `k -> *'
In the type `SMaybe s (Just a)'
In the definition of data constructor `SJust'
In the data declaration for `SMaybe'
The code compiles fine without the explicit forall
annotations, but other, more involved code I'm working on (involving Proxy
) requires the annotations, so simply omitting the explicit kind annotations is not always a viable workaround.
Trac metadata
Trac field | Value |
---|---|
Version | 7.5 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |