Skip to content

Eliminate excessive RuntimeRep polymorphism in primops

Currently there are numerous primops whose types are parametrically polymorphic in RuntimeRep yet only work with pointers (namely LiftedPtrRep and UnliftedPtrRep). This uneasy situation is forced by the fact that we currently don't have a convenient way to distinguish pointers from non-pointers. #17526 (closed) (GHC proposal 203) replaces the LiftedPtrRep and UnliftedPtrRep constructors of RuntimeRep with a BoxedRep :: Levity -> RuntimeRep constructor. This will allow us to give the correct types to the following primops:

  • mkWeak# and mkWeakNoFinalizer#
  • touch#
  • keepAlive# (once it's merged; see #17760 (closed))

Implementing this idea depends on completing !2249 (closed) (BoxedRep)

Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information