Add -XMultiParamTypeClasses flag
authorIan Lynagh <igloo@earth.li>
Sun, 8 Jul 2007 12:27:53 +0000 (12:27 +0000)
committerIan Lynagh <igloo@earth.li>
Sun, 8 Jul 2007 12:27:53 +0000 (12:27 +0000)
compiler/main/DynFlags.hs
compiler/typecheck/TcTyClsDecls.lhs

index cd373f9..86bbf31 100644 (file)
@@ -183,6 +183,7 @@ data DynFlag
    | Opt_RecordPuns
    | Opt_GADTs
    | Opt_RelaxedPolyRec                        -- -X=RelaxedPolyRec
+   | Opt_MultiParamTypeClasses
    | Opt_MagicHash
    | Opt_EmptyDataDecls
    | Opt_KindSignatures
@@ -1126,6 +1127,7 @@ xFlags = [
   ( "ExtendedDefaultRules",            Opt_ExtendedDefaultRules ),
   ( "ImplicitParams",                  Opt_ImplicitParams ),
   ( "ScopedTypeVariables",             Opt_ScopedTypeVariables ),
+  ( "MultiParamTypeClasses",        Opt_MultiParamTypeClasses ),
   ( "AllowOverlappingInstances",       Opt_AllowOverlappingInstances ),
   ( "AllowUndecidableInstances",       Opt_AllowUndecidableInstances ),
   ( "AllowIncoherentInstances",        Opt_AllowIncoherentInstances )
@@ -1141,6 +1143,7 @@ glasgowExtsFlags = [ Opt_GlasgowExts
                   , Opt_GADTs
                   , Opt_ImplicitParams 
                   , Opt_ScopedTypeVariables
+           , Opt_MultiParamTypeClasses
                   , Opt_MagicHash
            , Opt_EmptyDataDecls
            , Opt_KindSignatures
index b942ec2..7623b19 100644 (file)
@@ -1060,10 +1060,11 @@ 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
 
        -- 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)
 
        -- Check the super-classes
        ; checkValidTheta (ClassSCCtxt (className cls)) theta
@@ -1138,7 +1139,7 @@ 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"))]
 
 noClassTyVarErr clas op
   = sep [ptext SLIT("The class method") <+> quotes (ppr op),