From: simonpj@microsoft.com Date: Thu, 21 Aug 2008 12:35:02 +0000 (+0000) Subject: Improve error message when 'forall' is not a keyword X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=cc45450cbe5031f9f90fcc44932a9ff1dd36efd2;p=ghc-hetmet.git Improve error message when 'forall' is not a keyword --- diff --git a/compiler/rename/RnEnv.lhs b/compiler/rename/RnEnv.lhs index 6c3567a..03e94bc 100644 --- a/compiler/rename/RnEnv.lhs +++ b/compiler/rename/RnEnv.lhs @@ -30,7 +30,7 @@ module RnEnv ( mapFvRn, mapFvRnCPS, warnUnusedMatches, warnUnusedModules, warnUnusedImports, warnUnusedTopBinds, warnUnusedLocalBinds, - dataTcOccs, unknownNameErr + dataTcOccs, unknownNameErr, perhapsForallMsg ) where #include "HsVersions.h" @@ -986,10 +986,13 @@ unknownNameErr rdr_name <+> quotes (ppr rdr_name)) , extra ] where - extra | rdr_name == forall_tv_RDR - = vcat [ptext (sLit "Perhaps you intended to use -XRankNTypes or similar flag"), - ptext (sLit "to enable explicit-forall syntax: forall . ?")] - | otherwise = empty + extra | rdr_name == forall_tv_RDR = perhapsForallMsg + | otherwise = empty + +perhapsForallMsg :: SDoc +perhapsForallMsg + = vcat [ ptext (sLit "Perhaps you intended to use -XRankNTypes or similar flag") + , ptext (sLit "to enable explicit-forall syntax: forall . ")] unknownSubordinateErr :: SDoc -> RdrName -> SDoc unknownSubordinateErr doc op -- Doc is "method of class" or diff --git a/compiler/rename/RnTypes.lhs b/compiler/rename/RnTypes.lhs index 7a0948e..0e047fe 100644 --- a/compiler/rename/RnTypes.lhs +++ b/compiler/rename/RnTypes.lhs @@ -538,7 +538,7 @@ opTyErr op ty@(HsOpTy ty1 _ _) 2 extra where extra | op == dot_tv_RDR && forall_head ty1 - = ptext (sLit "Perhaps you intended to use -XRankNTypes or similar flag") + = perhapsForallMsg | otherwise = ptext (sLit "Use -XTypeOperators to allow operators in types")