diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-05-02 16:30:38 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-05-04 13:39:59 +0100 |
commit | 783dfa744b14e682951a8358e51356a2dedda325 (patch) | |
tree | c00dd60642f0e57c09045c6a28827ea586f65a10 /compiler | |
parent | 239418cf94dede0f116bb859d1bb95891235eb76 (diff) | |
download | haskell-783dfa744b14e682951a8358e51356a2dedda325.tar.gz |
Teach optCoecion about FunCo
I was seeing coercions like
Nth 3 ((c2 -> c2) ; (c3 -> c4))
which made me realise that optCoercion was doing a bad job
of the (relatively new) FunCo.
In particular, opt_trans_rule needs a FunCo/FunCo case,
to go with the TyConAppCo/TyConAppCo case. Easy.
No behavioural change, some coercions will get smaller
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/types/OptCoercion.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/types/OptCoercion.hs b/compiler/types/OptCoercion.hs index 7f96754ea9..b1aa646a97 100644 --- a/compiler/types/OptCoercion.hs +++ b/compiler/types/OptCoercion.hs @@ -555,6 +555,11 @@ opt_trans_rule is in_co1@(TyConAppCo r1 tc1 cos1) in_co2@(TyConAppCo r2 tc2 cos2 fireTransRule "PushTyConApp" in_co1 in_co2 $ mkTyConAppCo r1 tc1 (opt_transList is cos1 cos2) +opt_trans_rule is in_co1@(FunCo r1 co1a co1b) in_co2@(FunCo r2 co2a co2b) + = ASSERT( r1 == r2 ) -- Just like the TyConAppCo/TyConAppCo case + fireTransRule "PushFun" in_co1 in_co2 $ + mkFunCo r1 (opt_trans is co1a co2a) (opt_trans is co1b co2b) + opt_trans_rule is in_co1@(AppCo co1a co1b) in_co2@(AppCo co2a co2b) = fireTransRule "TrPushApp" in_co1 in_co2 $ mkAppCo (opt_trans is co1a co2a) |