It reallocates the memory of the array and we could continue using the old array.
asPtrUnsafe :: MonadIO m => MutByteArray -> (Ptr a -> m b) -> m b
asPtrUnsafe arr f = do
contents <- liftIO $ pin arr
let !ptr = Ptr (byteArrayContents#
(unsafeCoerce# (getMutableByteArray# contents)))
r <- f ptr
liftIO $ touch contents
return r
It reallocates the memory of the array and we could continue using the old array.