Make catch#, keepAlive#... only levity polymorphic
This MR changes the types of continuation-style primops to enforce that the return representation is boxed.
Affected primops:
catch#
keepAlive#
-
maskAsyncExceptions#
,unmaskAsyncExceptions#
,maskUninterruptible#
For example, the type of keepAlive#
is changed from
forall
{a_lev} {b_rep}
(a :: TYPE (BoxedRep a_lev)) (b :: TYPE b_rep).
a -> State# s -> (State# s -> b) -> b
to
forall
{a_lev} {b_lev}
(a :: TYPE (BoxedRep a_lev)) (b :: TYPE (BoxedRep b_lev)).
a -> State# s -> (State# s -> (# State# s, b #)) -> (# State# s, b #)
Technically, we could allow a slightly more general type by insisting
that the representation of b
fit into a single machine register, but
enforcing this restriction would be a significant amount more work when
it isn't clear that anyone would benefit from it.
TODO:
-
Check that this doesn't impact user programs. -
Updates notes which mention the type of these primops. -
Update changelog. -
Write a CLC proposal.