Closed harendra-kumar closed 1 month ago
toForeignPtr
does not make sense when bounds aren't involved. We pass in the
whole MutableByteArray#
to the ForeignPtr
which has the information of
arrayCapacity
but not arrayLength
.
(ForeignPtr, Int)
will have all the information of Array
without loss.
We can however introduce asForeignPtr
passing the length as well.
We have introduced unsafeAsForeignPtr
Introduce something like
toForeignPtr
andfromForeignPtr
so that we can implement thetoArray
andfromArray
in streamly-bytestring.