enhance handling of contexts and kind signatures in datatype, type family and class declarations

Contexts in full generality (e.g. flexible contexts like Ref :<: f that are not
enclosed in parens) are not handled yet, but they seem rare at this point.