Behavior of touch#

Carter Schonwald carter.schonwald at gmail.com
Tue Dec 16 06:43:13 UTC 2014


the point of touch is to prevent premature GC, it actually gets erased at
the CMM level i believe.
That is, it only makes sense to apply touch to lifted types on the heap!

On Mon, Dec 15, 2014 at 4:21 PM, Brandon Simmons <
brandon.m.simmons at gmail.com> wrote:
>
> The `primitive` package exports a lifted version of the undocumented
> `touch#`
>
>     http://hackage.haskell.org/package/ghc-prim-0.3.1.0/docs/GHC-Prim.html
>
> which has type:
>
>     touch :: PrimMonad m => a -> m ()
>
> I'd like to know if this works correctly in general, or will it suffer
> from the same gotches w/r/t unboxing as with addFinalizer and Weak
> references? i.e. must it only be passed an unboxed type?
>
> Brandon
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20141216/29cb54cc/attachment.html>


More information about the Glasgow-haskell-users mailing list