<div dir="auto"><div>Hi Adithya,<div dir="auto"><br></div><div dir="auto">The representations are the same. You can do this. I do this somewhat often. Just avoid mutating in places where it could result in funky stuffs. This is usually pretty easy to spot.</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">chessai</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 24, 2023, 12:59 Adithya Kumar <<a href="mailto:adi.obilisetty@gmail.com">adi.obilisetty@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello all,<br><br>I have a use-case where I want to convert `ByteArray#` to `MutableByteArray#`<br>without the copy overhead.<br><br>Is the underlying memory structure of `ByteArray#` and `MutableByteArray#` the<br>same?<br><br>If I can guarantee that I won't mutate my `MutableByteArray#`, can I use<br>`unsafeCoerce#` on `ByteArray#` and treat it as `MutableByteArray#`?<br><br>Best,<br>Adithya<br></div>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank" rel="noreferrer">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div></div></div>