qforeign-0.62

Simon Peyton-Jones simonpj at microsoft.com
Tue Nov 28 08:25:31 EST 2000


Dear foreigners

Simon and I noticed this morning that ForeignObj should
really be parameterised.  The current type of newForeignObj is

  newForeignObj :: Ptr a -> IO () -> IO ForeignObj

This immediately loses the type information on the Ptr!
Shouldn't it be

  newForeignObj :: Ptr a -> IO () -> IO (ForeignObj a)

Or maybe we should shorten it to (FPtr a)?  ("F" for "finalised".)

Similarly
  withFPtr :: FPtr a -> (Ptr a -> IO b) -> IO b

It's bizarre to have
   withForeignObj :: ForeignObj -> (Ptr a -> IO b) -> IO b


What think you?

Simon




More information about the FFI mailing list