`StablePtr` in `ST`

David Feuer david.feuer at gmail.com
Wed Aug 21 00:39:10 UTC 2019

So something like

newtype StablePtr a = StablePtr (StablePtrST RealWorld a)?

I suppose that could work with some discipline. You have to assume that
foreign code doesn't pick its address out of a hat and so something silly,
but I guess you pretty much have to assume that anyway.

On Wed, Aug 21, 2019, 5:00 AM Matthew Farkas-Dyck <strake888 at gmail.com>

> I have been doing some work where i want `StablePtr`, but also to not
> be confined to `IO`. I saw the following comment in
> "compiler/prelude/PrimOp.hs":
> Question: Why @RealWorld@ - won't any instance of @_ST@ do the job? [ADR]
> It has been there for 20 years. What is the answer? If it is safe i'll
> send the patch generalizing these operations.
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20190821/824d5a73/attachment.html>

More information about the ghc-devs mailing list