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
06facab6
Commit
06facab6
authored
11 years ago
by
Joachim Breitner
Browse files
Options
Downloads
Patches
Plain Diff
Refactor deferTcSForAllEq: Do not bind, but return EvTerm
parent
1791ea0a
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compiler/typecheck/TcCanonical.lhs
+4
-2
4 additions, 2 deletions
compiler/typecheck/TcCanonical.lhs
compiler/typecheck/TcSMonad.lhs
+4
-5
4 additions, 5 deletions
compiler/typecheck/TcSMonad.lhs
with
8 additions
and
7 deletions
compiler/typecheck/TcCanonical.lhs
+
4
−
2
View file @
06facab6
...
...
@@ -245,7 +245,8 @@ canClass ev cls tys
, CtWanted { ctev_loc = loc, ctev_evar = orig_ev } <- ev
, equalLength tvs1 tvs2
= do { traceTcS "Creating implication for polytype coercible equality" $ ppr ev
; deferTcSForAllEq Representational (loc,orig_ev) (tvs1,body1) (tvs2,body2)
; ev_term <- deferTcSForAllEq Representational loc (tvs1,body1) (tvs2,body2)
; setEvBind orig_ev ev_term
; return Stop }
canClass ev cls tys
...
...
@@ -766,7 +767,8 @@ canEqNC ev s1@(ForAllTy {}) s2@(ForAllTy {})
canEqFailure ev s1 s2
else
do { traceTcS "Creating implication for polytype equality" $ ppr ev
; deferTcSForAllEq Nominal (loc,orig_ev) (tvs1,body1) (tvs2,body2)
; ev_term <- deferTcSForAllEq Nominal loc (tvs1,body1) (tvs2,body2)
; setEvBind orig_ev ev_term
; return Stop } }
| otherwise
= do { traceTcS "Ommitting decomposition of given polytype equality" $
...
...
This diff is collapsed.
Click to expand it.
compiler/typecheck/TcSMonad.lhs
+
4
−
5
View file @
06facab6
...
...
@@ -1751,13 +1751,13 @@ matchFam tycon args
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
deferTcSForAllEq :: Role -- Nominal or Representational
->
(
CtLoc
,EvVar)
-- Original wanted equality flavor
-> CtLoc -- Original wanted equality flavor
-> ([TyVar],TcType) -- ForAll tvs1 body1
-> ([TyVar],TcType) -- ForAll tvs2 body2
-> TcS
()
-> TcS
EvTerm
-- Some of this functionality is repeated from TcUnify,
-- consider having a single place where we create fresh implications.
deferTcSForAllEq role
(
loc
,orig_ev)
(tvs1,body1) (tvs2,body2)
deferTcSForAllEq role loc (tvs1,body1) (tvs2,body2)
= do { (subst1, skol_tvs) <- wrapTcS $ TcM.tcInstSkolTyVars tvs1
; let tys = mkTyVarTys skol_tvs
phi1 = Type.substTy subst1 body1
...
...
@@ -1790,8 +1790,7 @@ deferTcSForAllEq role (loc,orig_ev) (tvs1,body1) (tvs2,body2)
; updTcSImplics (consBag imp)
; return (TcLetCo ev_binds new_co) }
; setEvBind orig_ev $
EvCoercion (foldr mkTcForAllCo coe_inside skol_tvs)
; return $ EvCoercion (foldr mkTcForAllCo coe_inside skol_tvs)
}
\end{code}
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