X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcTyClsDecls.lhs;h=9e302c3a6168517439296fa036d235ce9b6df19a;hb=fcb83d8469d4d7f282754387369aa86d40429dcf;hp=7623b191cb1d861f7d10cf578ad29f27bdca43b8;hpb=44e3fc1f918ee82d58e5dc9c63aa145c554867f3;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcTyClsDecls.lhs b/compiler/typecheck/TcTyClsDecls.lhs index 7623b19..9e302c3 100644 --- a/compiler/typecheck/TcTyClsDecls.lhs +++ b/compiler/typecheck/TcTyClsDecls.lhs @@ -693,7 +693,6 @@ 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 @@ -1061,10 +1060,12 @@ 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 (multi_param_type_classes || unary) (classArityErr cls) + ; checkTc (fundep_classes || null fundeps) (classFunDepsErr cls) -- Check the super-classes ; checkValidTheta (ClassSCCtxt (className cls)) theta @@ -1078,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] @@ -1141,6 +1142,10 @@ classArityErr cls = vcat [ptext SLIT("Too many parameters for class") <+> quotes (ppr cls), 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), ptext SLIT("mentions none of the type variables of the class") <+>