+sortLocated :: [Located a] -> [Located a]
+sortLocated things = sortLe le things
+ where
+ le (L l1 _) (L l2 _) = l1 <= l2
+
+badDataConTyCon data_con
+ = hang (ptext SLIT("Data constructor") <+> quotes (ppr data_con) <+>
+ ptext SLIT("returns type") <+> quotes (ppr (dataConTyCon data_con)))
+ 2 (ptext SLIT("instead of its parent type"))
+
+badGadtDecl tc_name
+ = vcat [ ptext SLIT("Illegal generalised algebraic data declaration for") <+> quotes (ppr tc_name)
+ , nest 2 (parens $ ptext SLIT("Use -fglasgow-exts to allow GADTs")) ]
+
+newtypeConError tycon n
+ = sep [ptext SLIT("A newtype must have exactly one constructor,"),
+ nest 2 $ ptext SLIT("but") <+> quotes (ppr tycon) <+> ptext SLIT("has") <+> speakN n ]
+
+newtypeExError con
+ = sep [ptext SLIT("A newtype constructor cannot have an existential context,"),
+ nest 2 $ ptext SLIT("but") <+> quotes (ppr con) <+> ptext SLIT("does")]
+
+newtypeFieldErr con_name n_flds
+ = sep [ptext SLIT("The constructor of a newtype must have exactly one field"),
+ nest 2 $ ptext SLIT("but") <+> quotes (ppr con_name) <+> ptext SLIT("has") <+> speakN n_flds]
+
+emptyConDeclsErr tycon
+ = sep [quotes (ppr tycon) <+> ptext SLIT("has no constructors"),
+ nest 2 $ ptext SLIT("(-fglasgow-exts permits this)")]
+
+badBootClassDeclErr = ptext SLIT("Illegal class declaration in hs-boot file")