Commit 44e3fc1f authored by Ian Lynagh's avatar Ian Lynagh

Add -XMultiParamTypeClasses flag

parent c0cc5433
......@@ -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
......
......@@ -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),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment