Coercing a `ByteArray#` into a `MutableByteArray#`

Adithya Kumar adi.obilisetty at gmail.com
Mon Jul 24 17:59:13 UTC 2023


Hello all,

I have a use-case where I want to convert `ByteArray#` to
`MutableByteArray#`
without the copy overhead.

Is the underlying memory structure of `ByteArray#` and `MutableByteArray#`
the
same?

If I can guarantee that I won't mutate my `MutableByteArray#`, can I use
`unsafeCoerce#` on `ByteArray#` and treat it as `MutableByteArray#`?

Best,
Adithya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20230724/71b991a5/attachment.html>


More information about the ghc-devs mailing list