Refactor the simplification of join binders
This MR (for #18449 (closed)) refactors the Simplifier's treatment of join-point binders.
Specifically, it puts together, into
GHC.Core.Opt.Simplify.Env.adjustJoinPointType
two currently-separate ways in which we adjust the type of
a join point. As the comment says:
-- (adjustJoinPointType mult new_res_ty join_id) does two things:
--
-- 1. Set the return type of the join_id to new_res_ty
-- See Note [Return type for join points]
--
-- 2. Adjust the multiplicity of arrows in join_id's type, as
-- directed by 'mult'. See Note [Scaling join point arguments]
I think this actually fixes a latent bug, by ensuring that the
seIdSubst
and seInScope
have the right multiplicity on the type
of join points.
I did some tidying up while I was at it. No more
setJoinResTy
, or modifyJoinResTy
: instead it's done locally in
Simplify.Env.adjustJoinPointType