+
+---------------------------------------------------------------------
+fieldTypeMisMatch field_name
+ = sep [ptext SLIT("Different constructors give different types for field"), quotes (ppr field_name)]
+
+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]))
+
+classOpCtxt sel_id tau = sep [ptext SLIT("When checking the class method:"),
+ nest 2 (ppr sel_id <+> dcolon <+> ppr tau)]
+
+nullaryClassErr cls
+ = ptext SLIT("No parameters for class") <+> quotes (ppr cls)
+
+classArityErr cls
+ = vcat [ptext SLIT("Too many parameters for class") <+> quotes (ppr cls),
+ parens (ptext SLIT("Use -fglasgow-exts to allow multi-parameter classes"))]
+
+noClassTyVarErr clas op
+ = sep [ptext SLIT("The class method") <+> quotes (ppr op),
+ ptext SLIT("mentions none of the type variables of the class") <+>
+ ppr clas <+> hsep (map ppr (classTyVars clas))]
+
+genericMultiParamErr clas
+ = ptext SLIT("The multi-parameter class") <+> quotes (ppr clas) <+>
+ ptext SLIT("cannot have generic methods")
+
+badGenericMethodType op op_ty
+ = hang (ptext SLIT("Generic method type is too complex"))
+ 4 (vcat [ppr op <+> dcolon <+> ppr op_ty,
+ ptext SLIT("You can only use type variables, arrows, and tuples")])
+
+recSynErr syn_decls
+ = addSrcSpan (getLoc (head syn_decls)) $
+ addErr (sep [ptext SLIT("Cycle in type synonym declarations:"),
+ nest 2 (vcat (map ppr_decl syn_decls))])
+ where
+ ppr_decl (L loc decl) = ppr loc <> colon <+> ppr decl
+
+recClsErr cls_decls
+ = addSrcSpan (getLoc (head cls_decls)) $
+ addErr (sep [ptext SLIT("Cycle in class declarations (via superclasses):"),
+ nest 2 (vcat (map ppr_decl cls_decls))])