Open ocharles opened 1 year ago
Looks like this change is what causes the errors:
mkWeak#, mkWeakNoFinalizer#, touch# and keepAlive# are now levity-polymorphic instead of representation-polymorphic. For instance:
mkWeakNoFinalizer# :: forall {l :: Levity} {k :: Levity} (a :: TYPE (BoxedRep l)) (b :: TYPE (BoxedRep k)). a -> b -> State# RealWorld -> (# State# RealWorld, Weak# b #)
That is, the type signature now quantifies over the GHC.Exts.Levity of a instead of its GHC.Exts.RuntimeRep. In addition, this variable is now inferred, instead of specified, meaning that it is no longer eligible for visible type application. Note that b is now also levity-polymorphic, due to the change outlined in the previous point.
https://downloads.haskell.org/~ghc/9.4.5/docs/users_guide/9.4.1-notes.html
Specifically, I think this was introduced in MR !5877.
The fix seems to be to simply pass the boxed values to touch#
instead of deconstructing first, e.g.
- touch (F# f)
+ touch f
= IO (\state -> case touch# f state of
state' -> (# state', () #))
I don't know if that could block optimizations or cause safety issues though.