Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alex D
GHC
Commits
44e3fc1f
Commit
44e3fc1f
authored
Jul 08, 2007
by
Ian Lynagh
Browse files
Add -XMultiParamTypeClasses flag
parent
c0cc5433
Changes
2
Hide whitespace changes
Inline
Side-by-side
compiler/main/DynFlags.hs
View file @
44e3fc1f
...
...
@@ -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
...
...
compiler/typecheck/TcTyClsDecls.lhs
View file @
44e3fc1f
...
...
@@ -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_ext
s || unary) (classArityErr cls)
; checkTc (
multi_param_type_classe
s || 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-ext
s to allow multi-parameter classes"))]
parens (ptext SLIT("Use -
XMultiParamTypeClasse
s to allow multi-parameter classes"))]
noClassTyVarErr clas op
= sep [ptext SLIT("The class method") <+> quotes (ppr op),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment