Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
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
Terraform modules
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
glaubitz
GHC
Commits
c11a053d
Commit
c11a053d
authored
6 years ago
by
Tobias Dammers
Browse files
Options
Downloads
Patches
Plain Diff
Reinstate using FV for getting free vars
parent
3caf3dd4
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/types/TyCoRep.hs
+45
-41
45 additions, 41 deletions
compiler/types/TyCoRep.hs
with
45 additions
and
41 deletions
compiler/types/TyCoRep.hs
+
45
−
41
View file @
c11a053d
...
...
@@ -1532,50 +1532,54 @@ type TyCoVarSetNotClosed = TyCoVarSet
-- determinism info) and then drop the determinism. This is boring boiler plate code, but this
-- is measurably faster than going via FV.
tcvs_of_type
::
Type
->
TyCoVarSetNotClosed
tcvs_of_type
(
TyVarTy
v
)
=
unitVarSet
v
tcvs_of_type
(
TyConApp
_
tys
)
=
mapUnionVarSet
tcvs_of_type
tys
tcvs_of_type
(
LitTy
{})
=
emptyVarSet
tcvs_of_type
(
AppTy
fun
arg
)
=
tcvs_of_type
fun
`
unionVarSet
`
tcvs_of_type
arg
tcvs_of_type
(
FunTy
arg
res
)
=
tcvs_of_type
arg
`
unionVarSet
`
tcvs_of_type
res
tcvs_of_type
(
ForAllTy
(
TvBndr
tv
_
)
ty
)
=
tcvs_of_type
ty
`
delVarSet
`
tv
`
unionVarSet
`
tcvs_of_type
(
tyVarKind
tv
)
tcvs_of_type
(
CastTy
ty
co
)
=
tcvs_of_type
ty
`
unionVarSet
`
tcvs_of_co
co
tcvs_of_type
(
CoercionTy
co
)
=
tcvs_of_co
co
tcvs_of_type
=
fvVarSet
.
fvs_of_type
-- tcvs_of_type (TyVarTy v) = unitVarSet v
-- tcvs_of_type (TyConApp _ tys) = mapUnionVarSet tcvs_of_type tys
-- tcvs_of_type (LitTy {}) = emptyVarSet
-- tcvs_of_type (AppTy fun arg) = tcvs_of_type fun `unionVarSet` tcvs_of_type arg
-- tcvs_of_type (FunTy arg res) = tcvs_of_type arg `unionVarSet` tcvs_of_type res
-- tcvs_of_type (ForAllTy (TvBndr tv _) ty) = tcvs_of_type ty `delVarSet` tv
-- `unionVarSet` tcvs_of_type (tyVarKind tv)
-- tcvs_of_type (CastTy ty co) = tcvs_of_type ty `unionVarSet` tcvs_of_co co
-- tcvs_of_type (CoercionTy co) = tcvs_of_co co
--
tcvs_of_types
::
[
Type
]
->
TyCoVarSetNotClosed
tcvs_of_types
=
mapUnionVarSet
tcvs_of_type
tcvs_of_types
=
fvVarSet
.
fvs_of_types
-- tcvs_of_types = mapUnionVarSet tcvs_of_type
--
tcvs_of_co
::
Coercion
->
TyCoVarSetNotClosed
tcvs_of_co
(
Refl
_
ty
)
=
tcvs_of_type
ty
tcvs_of_co
(
TyConAppCo
_
_
cos
)
=
tcvs_of_cos
cos
tcvs_of_co
(
AppCo
co
arg
)
=
tcvs_of_co
co
`
unionVarSet
`
tcvs_of_co
arg
tcvs_of_co
(
ForAllCo
tv
kind_co
co
)
=
tcvs_of_co
co
`
delVarSet
`
tv
`
unionVarSet
`
tcvs_of_co
kind_co
tcvs_of_co
(
FunCo
_
co1
co2
)
=
tcvs_of_co
co1
`
unionVarSet
`
tcvs_of_co
co2
tcvs_of_co
(
CoVarCo
v
)
=
unitVarSet
v
tcvs_of_co
(
HoleCo
h
)
=
unitVarSet
(
coHoleCoVar
h
)
-- See Note [CoercionHoles and coercion free variables]
tcvs_of_co
(
AxiomInstCo
_
_
cos
)
=
tcvs_of_cos
cos
tcvs_of_co
(
UnivCo
p
_
t1
t2
)
=
tcvs_of_prov
p
`
unionVarSet
`
tcvs_of_type
t1
`
unionVarSet
`
tcvs_of_type
t2
tcvs_of_co
(
SymCo
co
)
=
tcvs_of_co
co
tcvs_of_co
(
TransCo
co1
co2
)
=
tcvs_of_co
co1
`
unionVarSet
`
tcvs_of_co
co2
tcvs_of_co
(
NthCo
_
_
co
)
=
tcvs_of_co
co
tcvs_of_co
(
LRCo
_
co
)
=
tcvs_of_co
co
tcvs_of_co
(
InstCo
co
arg
)
=
tcvs_of_co
co
`
unionVarSet
`
tcvs_of_co
arg
tcvs_of_co
(
CoherenceCo
c1
c2
)
=
tcvs_of_co
c1
`
unionVarSet
`
tcvs_of_co
c2
tcvs_of_co
(
KindCo
co
)
=
tcvs_of_co
co
tcvs_of_co
(
SubCo
co
)
=
tcvs_of_co
co
tcvs_of_co
(
AxiomRuleCo
_
cs
)
=
tcvs_of_cos
cs
tcvs_of_co
=
fvVarSet
.
fvs_of_co
-- tcvs_of_co (Refl _ ty) = tcvs_of_type ty
-- tcvs_of_co (TyConAppCo _ _ cos) = tcvs_of_cos cos
-- tcvs_of_co (AppCo co arg) = tcvs_of_co co `unionVarSet` tcvs_of_co arg
-- tcvs_of_co (ForAllCo tv kind_co co) = tcvs_of_co co `delVarSet` tv
-- `unionVarSet` tcvs_of_co kind_co
-- tcvs_of_co (FunCo _ co1 co2) = tcvs_of_co co1 `unionVarSet` tcvs_of_co co2
-- tcvs_of_co (CoVarCo v) = unitVarSet v
-- tcvs_of_co (HoleCo h) = unitVarSet (coHoleCoVar h)
-- -- See Note [CoercionHoles and coercion free variables]
-- tcvs_of_co (AxiomInstCo _ _ cos) = tcvs_of_cos cos
-- tcvs_of_co (UnivCo p _ t1 t2) = tcvs_of_prov p `unionVarSet` tcvs_of_type t1
-- `unionVarSet` tcvs_of_type t2
-- tcvs_of_co (SymCo co) = tcvs_of_co co
-- tcvs_of_co (TransCo co1 co2) = tcvs_of_co co1 `unionVarSet` tcvs_of_co co2
-- tcvs_of_co (NthCo _ _ co) = tcvs_of_co co
-- tcvs_of_co (LRCo _ co) = tcvs_of_co co
-- tcvs_of_co (InstCo co arg) = tcvs_of_co co `unionVarSet` tcvs_of_co arg
-- tcvs_of_co (CoherenceCo c1 c2) = tcvs_of_co c1 `unionVarSet` tcvs_of_co c2
-- tcvs_of_co (KindCo co) = tcvs_of_co co
-- tcvs_of_co (SubCo co) = tcvs_of_co co
-- tcvs_of_co (AxiomRuleCo _ cs) = tcvs_of_cos cs
--
tcvs_of_cos
::
[
Coercion
]
->
TyCoVarSetNotClosed
tcvs_of_cos
=
mapUnionVarSet
tcvs_of_co
tcvs_of_prov
::
UnivCoProvenance
->
TyCoVarSetNotClosed
tcvs_of_prov
UnsafeCoerceProv
=
emptyVarSet
tcvs_of_prov
(
PhantomProv
co
)
=
tcvs_of_co
co
tcvs_of_prov
(
ProofIrrelProv
co
)
=
tcvs_of_co
co
tcvs_of_prov
(
PluginProv
_
)
=
emptyVarSet
tcvs_of_cos
=
fvVarSet
.
fvs_of_cos
-- tcvs_of_cos = mapUnionVarSet tcvs_of_co
--
-- tcvs_of_prov :: UnivCoProvenance -> TyCoVarSetNotClosed
-- tcvs_of_prov UnsafeCoerceProv = emptyVarSet
-- tcvs_of_prov (PhantomProv co) = tcvs_of_co co
-- tcvs_of_prov (ProofIrrelProv co) = tcvs_of_co co
-- tcvs_of_prov (PluginProv _) = emptyVarSet
-- | `tyCoFVsOfType` that returns free variables of a type in a deterministic
-- set. For explanation of why using `VarSet` is not deterministic see
...
...
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