haskell/primitive

Add keepAlive in addition to touch?

Closed this issue · 2 comments

The keepAlive# primop has been there for some time. Maybe it makes sense to have a PrimMonad-polymorphic keepAlive, defined similarly to touch. And it can work for all GHC major versions, when keepAlive# is not present, a stub implementation using touch is possible.

I can open a PR for this if primitive maintainers consider this a worthy idea.

Yeah, this is definitely something we want in primitive.

We definitely want that! The stub needs to be properly NOINLINEd and such; see the way it was originally defined in GHC.Exts in version mumble mumble.