Commit 882e439b authored by Simon Peyton Jones's avatar Simon Peyton Jones

Simplify TcSMonad.matchFam's interface

parent 0d74feea
......@@ -1827,10 +1827,10 @@ doTopReact _inerts (CFunEqCan { cc_flavor = fl })
doTopReact _inerts workItem@(CFunEqCan { cc_id = cv, cc_flavor = fl
, cc_fun = tc, cc_tyargs = args, cc_rhs = xi })
= ASSERT (isSynFamilyTyCon tc) -- No associated data families have reached that far
do { match_res <- matchFam tc args -- See Note [MATCHING-SYNONYMS]
do { match_res <- matchFam tc args -- See Note [MATCHING-SYNONYMS]
; case match_res of
MatchInstNo -> return NoTopInt
MatchInstSingle (rep_tc, rep_tys)
Nothing -> return NoTopInt
Just (rep_tc, rep_tys)
-> do { let Just coe_tc = tyConFamilyCoercion_maybe rep_tc
Just rhs_ty = tcView (mkTyConApp rep_tc rep_tys)
-- Eagerly expand away the type synonym on the
......@@ -1864,8 +1864,6 @@ doTopReact _inerts workItem@(CFunEqCan { cc_id = cv, cc_flavor = fl
, tir_new_inert = Stop }
}
}
_
-> panicTcS $ text "TcSMonad.matchFam returned multiple instances!"
}
......
......@@ -941,15 +941,6 @@ matchClass clas tys
}
}
matchFam :: TyCon
-> [Type]
-> TcS (MatchInstResult (TyCon, [Type]))
matchFam tycon args
= do { mb <- wrapTcS $ TcM.tcLookupFamInst tycon args
; case mb of
Nothing -> return MatchInstNo
Just res -> return $ MatchInstSingle res
-- DV: We never return MatchInstMany, since tcLookupFamInst never returns
-- multiple matches. Check.
}
matchFam :: TyCon -> [Type] -> TcS (Maybe (TyCon, [Type]))
matchFam tycon args = wrapTcS $ TcM.tcLookupFamInst tycon args
\end{code}
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