Re: `StablePtr` in `ST`

David Feuer <[email protected]>
Newsgroups gmane.comp.lang.haskell.glasgow.user,gmane.comp.lang.haskell.ghc.devel
Message-ID <CAMgWh9sLaeaS0tb3qEuQf6PPQQgNs-hNb=xYG4VrTYXV4XV8HA@mail.gmail.com>
You also need to avoid inspecting the StablePtr itself, which is just a
number, to maintain purity. The whole thing is a bit weird. Why do you want
this anyway?

On Wed, Aug 21, 2019, 7:39 AM David Feuer <[email protected]> wrote:

> 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 <[email protected]>
> wrote:
>
>> 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
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
>>
>

_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.