Commit fbb99e83 authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

A little refactoring (remove redundant argument passed to isGoodRecEv)

parent 0c1a685f
...@@ -840,9 +840,9 @@ interactWithInert fdimprs inert workitem ...@@ -840,9 +840,9 @@ interactWithInert fdimprs inert workitem
-- We don't have to do this for givens, as we fully know the evidence for them. -- We don't have to do this for givens, as we fully know the evidence for them.
; rec_ev_ok <- ; rec_ev_ok <-
case (cc_flavor inert, cc_flavor workitem) of case (cc_flavor inert, cc_flavor workitem) of
(Wanted loc, Derived {}) -> isGoodRecEv work_ev (WantedEvVar inert_ev loc) (Wanted {}, Derived {}) -> isGoodRecEv work_ev inert_ev
(Derived {}, Wanted loc) -> isGoodRecEv inert_ev (WantedEvVar work_ev loc) (Derived {}, Wanted {}) -> isGoodRecEv inert_ev work_ev
_ -> return True _ -> return True
; if is_allowed && rec_ev_ok then ; if is_allowed && rec_ev_ok then
doInteractWithInert fdimprs inert workitem doInteractWithInert fdimprs inert workitem
......
...@@ -861,7 +861,7 @@ newDictVar cl tys = wrapTcS $ TcM.newDict cl tys ...@@ -861,7 +861,7 @@ newDictVar cl tys = wrapTcS $ TcM.newDict cl tys
\begin{code} \begin{code}
isGoodRecEv :: EvVar -> WantedEvVar -> TcS Bool isGoodRecEv :: EvVar -> EvVar -> TcS Bool
-- In a call (isGoodRecEv ev wv), we are considering solving wv -- In a call (isGoodRecEv ev wv), we are considering solving wv
-- using some term that involves ev, such as: -- using some term that involves ev, such as:
-- by setting wv = ev -- by setting wv = ev
...@@ -876,7 +876,7 @@ isGoodRecEv :: EvVar -> WantedEvVar -> TcS Bool ...@@ -876,7 +876,7 @@ isGoodRecEv :: EvVar -> WantedEvVar -> TcS Bool
-- call (constructor) and -1 for every superclass selection (destructor). -- call (constructor) and -1 for every superclass selection (destructor).
-- --
-- See Note [Superclasses and recursive dictionaries] in TcInteract -- See Note [Superclasses and recursive dictionaries] in TcInteract
isGoodRecEv ev_var (WantedEvVar wv _) isGoodRecEv ev_var wv
= do { tc_evbinds <- getTcEvBindsBag = do { tc_evbinds <- getTcEvBindsBag
; mb <- chase_ev_var tc_evbinds wv 0 [] ev_var ; mb <- chase_ev_var tc_evbinds wv 0 [] ev_var
; return $ case mb of ; return $ case mb of
...@@ -896,16 +896,7 @@ isGoodRecEv ev_var (WantedEvVar wv _) ...@@ -896,16 +896,7 @@ isGoodRecEv ev_var (WantedEvVar wv _)
| Just (EvBind _ ev_trm) <- lookupEvBind assocs orig | Just (EvBind _ ev_trm) <- lookupEvBind assocs orig
= chase_ev assocs trg curr_grav (orig:visited) ev_trm = chase_ev assocs trg curr_grav (orig:visited) ev_trm
{- No longer needed: evidence is in the EvBinds | otherwise = return Nothing
| isTcTyVar orig && isMetaTyVar orig
= do { meta_details <- wrapTcS $ TcM.readWantedCoVar orig
; case meta_details of
Flexi -> return Nothing
Indirect tyco -> chase_ev assocs trg curr_grav
(orig:visited) (EvCoercion tyco)
}
-}
| otherwise = return Nothing
chase_ev assocs trg curr_grav visited (EvId v) chase_ev assocs trg curr_grav visited (EvId v)
= chase_ev_var assocs trg curr_grav visited v = chase_ev_var assocs trg curr_grav visited v
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment