Re: Coercing a `ByteArray#` into a `MutableByteArray#`

2023-07-24 Thread Ben Gamari
Adithya Kumar writes: > 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 `MutableByte

Re: Coercing a `ByteArray#` into a `MutableByteArray#`

2023-07-24 Thread Sam Derbyshire
Indeed, this is what the `primitive` package provides to thaw a `ByteArray#` without copying: https://hackage.haskell.org/package/primitive-0.8.0.0/docs/src/Data.Primitive.ByteArray.html#unsafeThawByteArray On Mon, 24 Jul 2023, 20:17 chessai, wrote: > Hi Adithya, > > The representations are the

Re: Coercing a `ByteArray#` into a `MutableByteArray#`

2023-07-24 Thread chessai
Hi Adithya, 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. Cheers, chessai On Mon, Jul 24, 2023, 12:59 Adithya Kumar wrote: > Hello all, > > I have a use-case

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

2023-07-24 Thread Adithya Kumar
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 `By

RFC Or patterns syntax: (p1 | p2) vs. (p1; p2)

2023-07-24 Thread Sebastian Graf
Hi devs, I would like to invite you to provide arguments for or against the Or patterns syntax RFC `(p1; p2)` vs. `(p1 | p2)` over at this GH issue . *In particular, `(p1 | p2)` has a small lead over `(p1; p2)`*, but the latter will steal

ghc-9.4.6 is being prepared

2023-07-24 Thread Matthew Pickering
Hi all, Zubin is preparing the 9.4.6 release so we expect to release it within the next two weeks. The focus of the release ot back-port the quite large number of fixes which are marked for backport to 9.4. https://gitlab.haskell.org/ghc/ghc/-/merge_requests?scope=all&state=opened&label_name[]=b