X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fparser%2FRdrHsSyn.lhs;fp=compiler%2Fparser%2FRdrHsSyn.lhs;h=052b9a689c0908f23dc7d15f407f0cc74643a47d;hp=47abf232e23181fe556aa754bd1052d9dc5b8862;hb=2a26efb65343e31957b043f63c43caf24d5eeb30;hpb=5cfe9e92a92201043d5dbb1c4e10fef0ed0d9f49 diff --git a/compiler/parser/RdrHsSyn.lhs b/compiler/parser/RdrHsSyn.lhs index 47abf23..052b9a6 100644 --- a/compiler/parser/RdrHsSyn.lhs +++ b/compiler/parser/RdrHsSyn.lhs @@ -812,17 +812,20 @@ checkValSig lhs@(L l _) ty ppr lhs <+> text "::" <+> ppr ty) $$ text hint) where - hint = if looks_like_foreign lhs + hint = if foreign_RDR `looks_like` lhs then "Perhaps you meant to use -XForeignFunctionInterface?" - else "Should be of form :: " + else if generic_RDR `looks_like` lhs + then "Perhaps you meant to use -XGenerics?" + else "Should be of form :: " -- A common error is to forget the ForeignFunctionInterface flag -- so check for that, and suggest. cf Trac #3805 -- Sadly 'foreign import' still barfs 'parse error' because 'import' is a keyword - looks_like_foreign (L _ (HsVar v)) = v == foreign_RDR - looks_like_foreign (L _ (HsApp lhs _)) = looks_like_foreign lhs - looks_like_foreign _ = False + looks_like s (L _ (HsVar v)) = v == s + looks_like s (L _ (HsApp lhs _)) = looks_like s lhs + looks_like s _ = False foreign_RDR = mkUnqual varName (fsLit "foreign") + generic_RDR = mkUnqual varName (fsLit "generic") checkDoAndIfThenElse :: LHsExpr RdrName -> Bool