-checkTopTypeD :: LTyClDecl RdrName -> P (HsDecl RdrName)
-checkTopTypeD (L _ d@TyData {tcdTyPats = Just typats}) =
- do
- -- `tcdTyPats' will only be of the form `Just typats' if `typats' contains
- -- a non-variable pattern. We call `checkTyPats' instead of raising an
- -- error straight away, as `checkTyPats' raises the error at the location
- -- of that non-variable pattern.
- --
- checkTyVars typats False
- panic "checkTopTypeD: check on previous line should fail w/ a parse error"
-checkTopTypeD (L _ d) = return $ TyClD d
+checkKindSigs :: [LTyClDecl RdrName] -> P ()
+checkKindSigs = mapM_ check
+ where
+ check (L l tydecl)
+ | isKindSigDecl tydecl
+ || isSynDecl tydecl = return ()
+ | otherwise =
+ parseError l "Type declaration in a class must be a kind signature or synonym default"