Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
74721612
Commit
74721612
authored
Jul 08, 2007
by
Ian Lynagh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement -XFunctionalDependencies
parent
c71662b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
compiler/main/DynFlags.hs
compiler/main/DynFlags.hs
+3
-0
compiler/typecheck/TcTyClsDecls.lhs
compiler/typecheck/TcTyClsDecls.lhs
+7
-1
No files found.
compiler/main/DynFlags.hs
View file @
74721612
...
...
@@ -184,6 +184,7 @@ data DynFlag
|
Opt_GADTs
|
Opt_RelaxedPolyRec
-- -X=RelaxedPolyRec
|
Opt_MultiParamTypeClasses
|
Opt_FunctionalDependencies
|
Opt_MagicHash
|
Opt_EmptyDataDecls
|
Opt_KindSignatures
...
...
@@ -1133,6 +1134,7 @@ xFlags = [
(
"ImplicitParams"
,
Opt_ImplicitParams
),
(
"ScopedTypeVariables"
,
Opt_ScopedTypeVariables
),
(
"MultiParamTypeClasses"
,
Opt_MultiParamTypeClasses
),
(
"FunctionalDependencies"
,
Opt_FunctionalDependencies
),
(
"GeneralizedNewtypeDeriving"
,
Opt_GeneralizedNewtypeDeriving
),
(
"AllowOverlappingInstances"
,
Opt_AllowOverlappingInstances
),
(
"AllowUndecidableInstances"
,
Opt_AllowUndecidableInstances
),
...
...
@@ -1150,6 +1152,7 @@ glasgowExtsFlags = [ Opt_GlasgowExts
,
Opt_ImplicitParams
,
Opt_ScopedTypeVariables
,
Opt_MultiParamTypeClasses
,
Opt_FunctionalDependencies
,
Opt_MagicHash
,
Opt_RecursiveDo
,
Opt_ParallelListComp
...
...
compiler/typecheck/TcTyClsDecls.lhs
View file @
74721612
...
...
@@ -1061,10 +1061,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 +1080,7 @@ checkValidClass cls
; checkTc (unary || no_generics) (genericMultiParamErr cls)
}
where
(tyvars,
theta, _, op_stuff) = class
BigSig cls
(tyvars,
fundeps, theta, _, _, op_stuff) = classExtra
BigSig cls
unary = isSingleton tyvars
no_generics = null [() | (_, GenDefMeth) <- op_stuff]
...
...
@@ -1141,6 +1143,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") <+>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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