Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
b024f2af
Commit
b024f2af
authored
Feb 05, 2007
by
simonpj@microsoft.com
Browse files
Implement the PushT rule from the FC paper
parent
b2cc243a
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/simplCore/Simplify.lhs
View file @
b024f2af
...
...
@@ -772,9 +772,19 @@ simplCast env body co cont
, s1 `coreEqType` t1 = cont -- The coerces cancel out
| otherwise = CoerceIt (mkTransCoercion co1 co2) cont
add_coerce co (s1s2, t1t2) (ApplyTo dup (Type arg_ty) arg_se cont)
-- (f `cast` g) ty ---> (f ty) `cast` (g @ ty)
-- This implements the PushT rule from the paper
| Just (tyvar,_) <- splitForAllTy_maybe s1s2
, not (isCoVar tyvar)
= ApplyTo dup (Type ty') (zapSubstEnv env) (addCoerce (mkInstCoercion co ty') cont)
where
ty' = substTy arg_se arg_ty
-- ToDo: the PushC rule is not implemented at all
add_coerce co (s1s2, t1t2) (ApplyTo dup arg arg_se cont)
| not (isTypeArg arg) -- This whole case only works for value args
-- Could upgrade to have equiv thing for type apps too
| not (isTypeArg arg) -- This implements the Push rule from the paper
, isFunTy s1s2 -- t1t2 must be a function type, becuase it's applied
-- co : s1s2 :=: t1t2
-- (coerce (T1->T2) (S1->S2) F) E
...
...
Write
Preview
Supports
Markdown
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