[GHC] #14691: Replace EvTerm with CoreExpr
GHC
ghc-devs at haskell.org
Mon Jan 22 19:48:50 UTC 2018
#14691: Replace EvTerm with CoreExpr
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner: (none)
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.3
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by nomeata):
Hmpf, no matter how I shake it, it converges back to having many
constructors for `EvTerm`.
At first I added only `EvTypeable`, because we have determined that we
cannot create the Core for that during constraint solving.
But then I find code like this:
{{{
rewriteEvidence ev@(CtWanted { ctev_dest = dest
, ctev_loc = loc }) new_pred co
= do { mb_new_ev <- newWanted loc new_pred
; MASSERT( tcCoercionRole co == ctEvRole ev )
; setWantedEvTerm dest
(mkEvCast (getEvTerm mb_new_ev)
(tcDowngradeRole Representational (ctEvRole
ev) co))
; case mb_new_ev of
Fresh new_ev -> continueWith new_ev
Cached _ -> stopWith ev "Cached wanted" }
}}}
where an arbitrary `EvTerm`, the result of `getEvTerm` needs to be casted.
I cannot use Core’s `Cast` for that, because the `EvTerm` may be a
`EvTypeable`. So seems that I need to add the `EvCast` constructor back to
`EvTerm` … and bit by bit I am undoing the refactoring that I was hoping
to do here…
Maybe the better thing to do is to leave all the existing constructors in
place, and just add `EvExpr :: CoreExpr -> EvTerm` as an additional leaf
constructor. This way, the existing code structure can remain.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14691#comment:23>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list