RE: Ptr and ForeignPtr Questions

20 Sep
2001
20 Sep
'01
5:38 a.m.
At 2001-09-20 02:14, Simon Marlow wrote:
I'll just add that the docs have been updated for 5.02,
Do you have a URL for that?
And don't forget that using foreignPtrToPtr is quite dangerous; much better to use withForeignPtr instead, otherwise you might find the ForeignPtr being finalised earlier than you expect.
This is because foreignPtrToPtr is not in the IO monad, correct? foreignPtrToPtr :: ForeignPtr a -> Ptr a; A function like this: ioForeignPtrToPtr :: ForeignPtr a -> IO (Ptr a); ioForeignPtrToPtr fp = withForeignPtr fp return; ...would surely be safe? The 5.00 documentation claims that it isn't, however, but I don't see why. -- Ashley Yakeley, Seattle WA
8645
Age (days ago)
8645
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ashley Yakeley