-dataConCtxt con = sep [ptext SLIT("When checking the data constructor:"),
- nest 2 (ex_part <+> pprThetaArrow ex_theta <+> ppr con <+> arg_part)]
- where
- (ex_tvs, ex_theta, arg_tys, _, _) = dataConSig con
- ex_part | null ex_tvs = empty
- | otherwise = ptext SLIT("forall") <+> hsep (map ppr ex_tvs) <> dot
- -- The 'ex_theta' part could be non-empty, if the user (bogusly) wrote
- -- data T a = Eq a => T a a
- -- So we make sure to print it
-
- fields = dataConFieldLabels con
- arg_part | null fields = sep (map pprParendType arg_tys)
- | otherwise = braces (sep (punctuate comma
- [ ppr n <+> dcolon <+> ppr ty
- | (n,ty) <- fields `zip` arg_tys]))