Eta-expand through join points
f x = join j y = case y of True -> \a. blah False -> \b. blah in case x of A -> j True B -> \c. blah C -> j False
and suppose the join point is too big to inline. Now, what is the arity of f?
If we inlined the join point, we'd definitely say "arity 2" because we are prepared to push case-scrutinisation inside a lambda.
But currently the join point totally messes all that up: we'll just say arity 1. Silly!
As so often with join points, a simple solution is available:
- treat the RHS of the join point very like an extra case alterantive; it is one way that this expression might return
- totally ignore calls to the join point -- those branches are taken care of by (1)
This should improve arities on functions involving join points. Perhaps quite a bit.
I tripped over this when looking at regressions in !3497 (closed), which produces more such join points.