Conversion between STRef RealWorld and IORef

John Lato jwlato at gmail.com
Mon Dec 1 21:21:46 UTC 2014


Really a function like mkWeakIORef should be exposed for STRef's. I know
there's supposed to be a patch to normalize various weak'ish things
(ekmett?), maybe that function could be added at the same time.

Until then, I would suggesy unpacking the STRef to get at the underlying
MutVar#, and copy the IORef code (which IIRC also works on MutVar#) to
write the function yourself.

John L.

On 07:56, Mon, Dec 1, 2014 Wolfgang Jeltsch <g9ks157k at acme.softbase.org>
wrote:

> Hi,
>
> I need to convert values of types STRef RealWorld a to IORef a in order
> to attach finalizers to them. For now, I am using GHC.IORef for this. Is
> there a better way to achieve what I want?
>
> All the best,
> Wolfgang
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141201/d0ee91f1/attachment.html>


More information about the Libraries mailing list