X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcTyClsDecls.lhs;h=9e302c3a6168517439296fa036d235ce9b6df19a;hb=fcb83d8469d4d7f282754387369aa86d40429dcf;hp=9c4b5b20d8ae954beacb17906e5e734d48cb27e1;hpb=f4e4060721bdbeee81d5e9fd3c8d909ece6195df;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcTyClsDecls.lhs b/compiler/typecheck/TcTyClsDecls.lhs index 9c4b5b2..9e302c3 100644 --- a/compiler/typecheck/TcTyClsDecls.lhs +++ b/compiler/typecheck/TcTyClsDecls.lhs @@ -693,8 +693,8 @@ tcTyClDecl1 calc_isrec ; stupid_theta <- tcHsKindedContext ctxt ; want_generic <- doptM Opt_Generics ; unbox_strict <- doptM Opt_UnboxStrictFields - ; gla_exts <- doptM Opt_GlasgowExts ; empty_data_decls <- doptM Opt_EmptyDataDecls + ; kind_signatures <- doptM Opt_KindSignatures ; gadt_ok <- doptM Opt_GADTs ; is_boot <- tcIsHsBoot -- Are we compiling an hs-boot file? @@ -702,7 +702,7 @@ tcTyClDecl1 calc_isrec ; checkTc (gadt_ok || h98_syntax) (badGadtDecl tc_name) -- Check that we don't use kind signatures without Glasgow extensions - ; checkTc (gla_exts || isNothing mb_ksig) (badSigTyDecl tc_name) + ; checkTc (kind_signatures || isNothing mb_ksig) (badSigTyDecl tc_name) -- Check that the stupid theta is empty for a GADT-style declaration ; checkTc (null stupid_theta || h98_syntax) (badStupidTheta tc_name) @@ -1059,10 +1059,13 @@ checkValidClass :: Class -> TcM () checkValidClass cls = do { -- CHECK ARITY 1 FOR HASKELL 1.4 gla_exts <- doptM Opt_GlasgowExts + ; multi_param_type_classes <- doptM Opt_MultiParamTypeClasses + ; fundep_classes <- doptM Opt_FunctionalDependencies -- Check that the class is unary, unless GlaExs ; checkTc (notNull tyvars) (nullaryClassErr cls) - ; checkTc (gla_exts || unary) (classArityErr cls) + ; checkTc (multi_param_type_classes || unary) (classArityErr cls) + ; checkTc (fundep_classes || null fundeps) (classFunDepsErr cls) -- Check the super-classes ; checkValidTheta (ClassSCCtxt (className cls)) theta @@ -1076,7 +1079,7 @@ checkValidClass cls ; checkTc (unary || no_generics) (genericMultiParamErr cls) } where - (tyvars, theta, _, op_stuff) = classBigSig cls + (tyvars, fundeps, theta, _, _, op_stuff) = classExtraBigSig cls unary = isSingleton tyvars no_generics = null [() | (_, GenDefMeth) <- op_stuff] @@ -1137,7 +1140,11 @@ nullaryClassErr cls classArityErr cls = vcat [ptext SLIT("Too many parameters for class") <+> quotes (ppr cls), - parens (ptext SLIT("Use -fglasgow-exts to allow multi-parameter classes"))] + parens (ptext SLIT("Use -XMultiParamTypeClasses to allow multi-parameter classes"))] + +classFunDepsErr cls + = vcat [ptext SLIT("Fundeps in class") <+> quotes (ppr cls), + parens (ptext SLIT("Use -XFunctionalDependencies to allow fundeps"))] noClassTyVarErr clas op = sep [ptext SLIT("The class method") <+> quotes (ppr op), @@ -1209,7 +1216,7 @@ newtypeFieldErr con_name n_flds badSigTyDecl tc_name = vcat [ ptext SLIT("Illegal kind signature") <+> quotes (ppr tc_name) - , nest 2 (parens $ ptext SLIT("Use -fglasgow-exts to allow kind signatures")) ] + , nest 2 (parens $ ptext SLIT("Use -XKindSignatures to allow kind signatures")) ] badFamInstDecl tc_name = vcat [ ptext SLIT("Illegal family instance for") <+>