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
Container 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
Craig Ferguson
GHC
Commits
30455b14
Commit
30455b14
authored
12 years ago
by
jpm@cs.ox.ac.uk
Browse files
Options
Downloads
Patches
Plain Diff
some fixes
parent
f3b9b3f0
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/typecheck/TcDeriv.lhs
+10
-6
10 additions, 6 deletions
compiler/typecheck/TcDeriv.lhs
with
10 additions
and
6 deletions
compiler/typecheck/TcDeriv.lhs
+
10
−
6
View file @
30455b14
...
...
@@ -583,11 +583,10 @@ deriveTyData tvs tc tc_args (L loc deriv_pred)
-- newtype deriving we allow deriving (forall a. C [a]).
-- Typeable is special
; pprTrace "tvs, deriv_tvs, cls_tys, tc, tc_args" (ppr (tvs, deriv_tvs, cls_tys, tc, tc_args))
$ if className cls == typeableClassName
; if className cls == typeableClassName
then mkEqnHelp DerivOrigin
tvs
cls cls_tys
(mkTyConApp tc tc_args) Nothing
tvs
cls cls_tys
(mkTyConApp tc
(kindVarsOnly
tc_args)
)
Nothing
else do {
-- Given data T a b c = ... deriving( C d ),
...
...
@@ -628,6 +627,12 @@ deriveTyData tvs tc tc_args (L loc deriv_pred)
(typeFamilyPapErr tc cls cls_tys inst_ty)
; mkEqnHelp DerivOrigin (varSetElemsKvsFirst univ_tvs) cls cls_tys inst_ty Nothing } }
where
kindVarsOnly :: [Type] -> [Type]
kindVarsOnly [] = []
kindVarsOnly (t:ts) | Just v <- getTyVar_maybe t
, isKindVar v = t : kindVarsOnly ts
| otherwise = kindVarsOnly ts
\end{code}
Note [Deriving, type families, and partial applications]
...
...
@@ -812,8 +817,7 @@ mkPolyKindedTypeableEqn :: CtOrigin -> [TyVar] -> Class -> [TcType]
mkPolyKindedTypeableEqn orig tvs cls cls_tys tycon tc_args mtheta
-- The kind-polymorphic Typeable class is less special; namely, there is no
-- need to select the class with the right kind anymore, as we only have one.
= do { pprTrace "tvs, tycon, tc_args" (ppr (tvs, tycon, tc_args))
$ checkTc (onlyKindVars tc_args)
= do { checkTc (onlyKindVars tc_args)
(ptext (sLit "Derived typeable instance must be of form (Typeable")
<+> ppr tycon <> rparen)
; dfun_name <- new_dfun_name cls tycon
...
...
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