Duplicated test in GHC.Tc.Solver.Rewrite.rewrite_exact_fam_app
In GHC.Tc.Solver.Rewrite.rewrite_exact_fam_app
we see
do { eq_rel <- getEqRel
-- checking eq_rel == NomEq saves ~0.5% in T9872a
; (xis, cos, kind_co) <- if eq_rel == NomEq
then rewrite_args_tc tc Nothing tys
else setEqRel NomEq $
rewrite_args_tc tc Nothing tys
but setEqRel
is this:
setEqRel :: EqRel -> RewriteM a -> RewriteM a
setEqRel new_eq_rel thing_inside
= RewriteM $ \env ->
if new_eq_rel == fe_eq_rel env
then runRewriteM thing_inside env
else runRewriteM thing_inside (env { fe_eq_rel = new_eq_rel })
So it performs exactly the same test again.
Do we need this duplication? Is the comment "checking eq_rel == NomEq saves ~0.5% in T9872a" accurate?