More general type signature for touch# and keepAlive#
The type signatures of touch#
and keepAlive#
are:
touch# :: v -> State# RealWorld -> State# RealWorld
keepAlive# :: v -> State# RealWorld -> (State# RealWorld -> p) -> p
There's a bit a nuance to these: v
is a boxed levity polymorphic type, and p
has to be a type that is represented by a single machine word, and also, p
needs to have the shape (# State# RealWorld, q #)
, pushing the size restriction onto q
.
All this aside, I'd like to make both of these work with any state token instead of just RealWorld
:
touch# :: v -> State# s -> State# s
keepAlive# :: v -> State# s -> (State# s -> p) -> p
This was originally discussed on primitive PR 375, where we realized that it would be nice to make sure that primitive
and GHC agree on what the type of these should look like.