- thing = case decl of
- ClassDecl {} -> "class"
- TySynonym {} -> "type synonym"
- TyFunction {} -> "type function signature"
- TyData {tcdND = NewType} -> "newtype" ++ maybeSig
- TyData {tcdND = DataType} -> "data type" ++ maybeSig
+ thing | isClassDecl decl = "class"
+ | isTypeDecl decl = "type synonym" ++ maybeInst
+ | isDataDecl decl = if tcdND decl == NewType
+ then "newtype" ++ maybeInst
+ else "data type" ++ maybeInst
+ | isFamilyDecl decl = "family"