ForeignPtr
Alastair Reid
alastair at reid-consulting-uk.ltd.uk
Thu Nov 7 11:53:04 EST 2002
>> On first glance, this looks cool. What instances do you envision
>> (assuming I persuaded you that StablePtr and FunPtr should not be)?
> How about Int (for file descriptors, etc)?
Ah, got you.
How about making ForeignPtr slightly more polymorphic so that instead of
working only on 'Ptr a' it works on 'a'.
e.g., We'd have:
newForeignPtr :: a -> Finalizer a -> IO ForeignThing a
obviously, we'd want to remove the word 'Ptr' from the name of the type.
Candidates:
ForeignProxy, ForeignObj, Foreign
I think 'Foreign' is an essential part (at least, given the
restriction to C finalizers) and I favour the first two over the last
which seems too general.
Trivial to implement, might require an additional layer of boxing in
GHC (maybe in Hugs too - I forget the implementation).
--
Alastair
More information about the FFI
mailing list