Skip to content

Kind variables not allowed in data declaration kind annotation

GHC won't accept kind variables stated directly in a data declaration. For example, the following does not compile:

data SMaybe :: (k -> *) -> Maybe k -> * where
  SNothing :: SMaybe s 'Nothing
  SJust :: s a -> SMaybe s ('Just a)

However, the following does compile:

data SMaybe' (s :: k -> *) (m :: Maybe k) where
  SNothing' :: SMaybe' s 'Nothing
  SJust' :: s a -> SMaybe' s ('Just a)
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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information