Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Kaznacheev
GHC
Commits
51bfcc0e
Commit
51bfcc0e
authored
13 years ago
by
Simon Peyton Jones
Committed by
Ian Lynagh
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow default superclass methods for multi-parameter type classes
They were prohibited by mistake, a historical hangover
parent
902650db
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/typecheck/TcTyClsDecls.lhs
+2
-14
2 additions, 14 deletions
compiler/typecheck/TcTyClsDecls.lhs
with
2 additions
and
14 deletions
compiler/typecheck/TcTyClsDecls.lhs
+
2
−
14
View file @
51bfcc0e
...
@@ -1365,17 +1365,10 @@ checkValidClass cls
...
@@ -1365,17 +1365,10 @@ checkValidClass cls
-- Check the associated type defaults are well-formed and instantiated
-- Check the associated type defaults are well-formed and instantiated
-- See Note [Checking consistent instantiation]
-- See Note [Checking consistent instantiation]
; mapM_ check_at_defs at_stuff
; mapM_ check_at_defs at_stuff }
-- Check that if the class has generic methods, then the
-- class has only one parameter. We can't do generic
-- multi-parameter type classes!
; checkTc (unary || no_generics) (genericMultiParamErr cls)
}
where
where
(tyvars, fundeps, theta, _, at_stuff, op_stuff) = classExtraBigSig cls
(tyvars, fundeps, theta, _, at_stuff, op_stuff) = classExtraBigSig cls
unary = isSingleton (snd (splitKiTyVars tyvars)) -- IA0_NOTE: only count type arguments
unary = isSingleton (snd (splitKiTyVars tyvars)) -- IA0_NOTE: only count type arguments
no_generics = null [() | (_, (GenDefMeth _)) <- op_stuff]
check_op constrained_class_methods (sel_id, dm)
check_op constrained_class_methods (sel_id, dm)
= addErrCtxt (classOpCtxt sel_id tau) $ do
= addErrCtxt (classOpCtxt sel_id tau) $ do
...
@@ -1700,11 +1693,6 @@ noClassTyVarErr clas op
...
@@ -1700,11 +1693,6 @@ noClassTyVarErr clas op
ptext (sLit "mentions none of the type variables of the class") <+>
ptext (sLit "mentions none of the type variables of the class") <+>
ppr clas <+> hsep (map ppr (classTyVars clas))]
ppr clas <+> hsep (map ppr (classTyVars clas))]
genericMultiParamErr :: Class -> SDoc
genericMultiParamErr clas
= ptext (sLit "The multi-parameter class") <+> quotes (ppr clas) <+>
ptext (sLit "cannot have generic methods")
recSynErr :: [LTyClDecl Name] -> TcRn ()
recSynErr :: [LTyClDecl Name] -> TcRn ()
recSynErr syn_decls
recSynErr syn_decls
= setSrcSpan (getLoc (head sorted_decls)) $
= setSrcSpan (getLoc (head sorted_decls)) $
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment