allocToForeignPtr :: (Ptr a -> IO ())    -- finalizer
                  -> IO (Ptr a)          -- allocate
                  -> IO (ForeignPtr a)
allocToForeignPtr fin alloc = do
  done <- asFinalizer fin
  newForeignPtr done =<< alloc
allocToForeignPtr :: (Ptr a -> IO ())    -- finalizer
                  -> IO (Ptr a)          -- allocate
                  -> IO (ForeignPtr a)
allocToForeignPtr fin alloc = do
  done <- asFinalizer fin
  newForeignPtr done =<< alloc
allocToForeignPtr fin alloc = do
  done <- asFinalizer fin
  newForeignPtr done =<< alloc