summaryrefslogtreecommitdiff
path: root/compiler/rename/RnBinds.lhs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2011-04-28 09:24:30 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2011-04-28 09:24:30 +0100
commit60401bfe16c49ef2e06e5e81fd58e030bea02013 (patch)
tree7622c6708be8ddace6544498d7999742c5d9a7f1 /compiler/rename/RnBinds.lhs
parentfbff1b7b9c89f6369c4394a0b10fa7c06e011698 (diff)
downloadhaskell-60401bfe16c49ef2e06e5e81fd58e030bea02013.tar.gz
Use 'default' rather than 'generic' for default-method signatures
Also get rid of the old {| |} brackets in the lexer. Fewer keywords!
Diffstat (limited to 'compiler/rename/RnBinds.lhs')
-rw-r--r--compiler/rename/RnBinds.lhs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs
index a18dfcef11..b0dd3b52f4 100644
--- a/compiler/rename/RnBinds.lhs
+++ b/compiler/rename/RnBinds.lhs
@@ -713,7 +713,9 @@ renameSig mb_names sig@(TypeSig v ty)
; return (TypeSig new_v new_ty) }
renameSig mb_names sig@(GenericSig v ty)
- = do { new_v <- lookupSigOccRn mb_names sig v
+ = do { generics_on <- xoptM Opt_Generics
+ ; unless generics_on (addErr (genericSigErr sig))
+ ; new_v <- lookupSigOccRn mb_names sig v
; new_ty <- rnHsSigType (quotes (ppr v)) ty
; return (GenericSig new_v new_ty) } -- JPM: ?
@@ -838,6 +840,11 @@ misplacedSigErr (L loc sig)
= addErrAt loc $
sep [ptext (sLit "Misplaced") <+> hsSigDoc sig <> colon, ppr sig]
+genericSigErr :: Sig RdrName -> SDoc
+genericSigErr sig = vcat [ hang (ptext (sLit "Unexpected generic default signature:"))
+ 2 (ppr sig)
+ , ptext (sLit "Use -XGenerics to enable generic default signatures") ]
+
methodBindErr :: HsBindLR RdrName RdrName -> SDoc
methodBindErr mbind
= hang (ptext (sLit "Pattern bindings (except simple variables) not allowed in instance declarations"))
@@ -852,4 +859,5 @@ nonStdGuardErr :: [LStmtLR Name Name] -> SDoc
nonStdGuardErr guards
= hang (ptext (sLit "accepting non-standard pattern guards (use -XPatternGuards to suppress this message)"))
4 (interpp'SP guards)
+
\end{code}