@@ -128,7 +128,7 @@ p_hsDecl style = \case
128128 DocCommentNamed name str -> p_hsDocString (Named name) False (noLoc str)
129129 DocGroup n str -> p_hsDocString (Asterisk n) False (noLoc str)
130130 RoleAnnotD NoExtField x -> p_roleAnnot x
131− KindSigD NoExtField _ -> notImplemented "StandaloneKindSignatures"
131+ KindSigD NoExtField s -> p_standaloneKindSig s
132132 XHsDecl x -> noExtCon x
133133
134134p_tyClDecl :: FamilyStyle -> TyClDecl GhcPs -> R ()
@@ -187,6 +187,9 @@ groupedDecls x y | Just ns <- isPragma x, Just ns' <- isPragma y = ns `intersect
187187groupedDecls x (TypeSignature ns) | Just ns' <- isPragma x = ns `intersects` ns'
188188groupedDecls (TypeSignature ns) x | Just ns' <- isPragma x = ns `intersects` ns'
189189groupedDecls (PatternSignature ns) (Pattern n) = n `elem` ns
190+groupedDecls (KindSignature n) (DataDeclaration n') = n == n'
191+groupedDecls (KindSignature n) (ClassDeclaration n') = n == n'
192+groupedDecls (KindSignature n) (FamilyDeclaration n') = n == n'
190193-- This looks only at Haddocks, normal comments are handled elsewhere
191194groupedDecls DocNext _ = True
192195groupedDecls _ DocPrev = True
@@ -224,7 +227,10 @@ pattern
224227 AnnTypePragma,
225228 AnnValuePragma,
226229 Pattern,
227− DataDeclaration ::
230+ DataDeclaration,
231+ ClassDeclaration,
232+ KindSignature,
233+ FamilyDeclaration ::
228234 RdrName -> HsDecl GhcPs
229235pattern InlinePragma n <- SigD NoExtField (InlineSig NoExtField (L _ n) _)
230236pattern SpecializePragma n <- SigD NoExtField (SpecSig NoExtField (L _ n) _ _)
@@ -233,6 +239,9 @@ pattern AnnTypePragma n <- AnnD NoExtField (HsAnnotation NoExtField _ (TypeAnnPr
233239pattern AnnValuePragma n <- AnnD NoExtField (HsAnnotation NoExtField _ (ValueAnnProvenance (L _ n)) _)
234240pattern Pattern n <- ValD NoExtField (PatSynBind NoExtField (PSB _ (L _ n) _ _ _))
235241pattern DataDeclaration n <- TyClD NoExtField (DataDecl NoExtField (L _ n) _ _ _)
242+pattern ClassDeclaration n <- TyClD NoExtField (ClassDecl NoExtField _ (L _ n) _ _ _ _ _ _ _ _)
243+pattern KindSignature n <- KindSigD NoExtField (StandaloneKindSig NoExtField (L _ n) _)
244+pattern FamilyDeclaration n <- TyClD NoExtField (FamDecl NoExtField (FamilyDecl NoExtField _ (L _ n) _ _ _ _))
236245
237246-- Declarations which can refer to multiple names
238247