streamly icon indicating copy to clipboard operation
streamly copied to clipboard

Add array conversion to and from foreignptr

Open harendra-kumar opened this issue 1 year ago • 1 comments

Introduce something like toForeignPtr and fromForeignPtr so that we can implement the toArray and fromArray in streamly-bytestring.

harendra-kumar avatar Jul 20 '24 20:07 harendra-kumar

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.

adithyaov avatar Jul 22 '24 16:07 adithyaov

We have introduced unsafeAsForeignPtr

adithyaov avatar Sep 10 '24 10:09 adithyaov