addErrCtxt (dataConCtxt con) $
do { checkTc (dataConTyCon con == tc) (badDataConTyCon con)
; checkValidType ctxt (dataConUserType con)
+ ; checkValidMonoType (dataConOrigResTy con)
+ -- Disallow MkT :: T (forall a. a->a)
+ -- Reason: it's really the argument of an equality constraint
; ifM (isNewTyCon tc) (checkNewDataCon con)
}
where
badExistential con_name
= hang (ptext SLIT("Data constructor") <+> quotes (ppr con_name) <+>
- ptext SLIT("has existential type variables, or a context, or both"))
+ ptext SLIT("has existential type variables, or a context"))
2 (parens $ ptext SLIT("Use -XExistentialQuantification or -XGADTs to allow this"))
badStupidTheta tc_name