Looks OK to me; but I’m no expert.
Simon
From: ghc-steering-committee On Behalf Of Simon Marlow
Sent: 18 May 2018 09:24
To: Joachim Breitner
Cc: ghc-steering-committee@haskell.org
Subject: [ghc-steering-committee] Array resizing primitives (#121), proposal: accept with modifications
I propose that we accept https://github.com/ghc-proposals/ghc-proposals/pull/121
With one modification (below).
In summary, this proposal suggests adding primitives for resizing (shrinking or expanding) primitives mutable arrays of pointers. See the proposal for motivation. There would be two primitives per array type:
shrinkArray# :: MutableArray# s a -> Int# -> State# s -> State# s
resizeArray# :: MutableArray# s a -> Int# -> a -> State# s -> (# State# s, MutableArray# s a #)
(these mirror the existing shrink and resize primitives we have for ByteArray#, with the same rationale)
The biggest downside is that we currently have
sizeOfMutableArray# :: MutableArray# s a -> Int #
which would need to be replaced by a stateful operation
getSizeOfMutableArray# :: MutableArray# s a -> State# s -> (# State# s, Int# #)
So we would need to deprecate the old primops, update any code we have that uses them, and clearly indicate the unsafety in the docs. But this has knock-on effects in Data.Primitive:
sizeofMutableArray :: MutableArray s a -> Int
this would need to be deprecated and replaced by a PrimMonad operation. The pure version would be unsafe in the sense that it could return the wrong size, and a future indexing operation relying on the incorrect size could access an out-of-bounds element.
Suggested modifications:
* Remove the ArrayArray# primitives, add UniftedArray# primitives instead (see https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0021-un...)
Cheers
Simon
On 1 May 2018 at 13:12, Joachim Breitner mailto:mail@joachim-breitner.de> wrote:
Dear Committee,
this is your secretary speaking:
Array resizing primitives have been proposed by David Feuer:
https://github.com/ghc-proposals/ghc-proposals/pull/121
I propose Simon Marlow as the shepherd.
Simon, please reach consensus as described in
https://github.com/ghc-proposals/ghc-proposals#committee-process
I suggest you make a recommendation, in a new e-mail thread with the
proposal number in the subject, about the decision, maybe point out
debatable points, and assume that anyone who stays quiet agrees with
you.
Thanks,
--
Joachim Breitner
mail@joachim-breitner.demailto:mail@joachim-breitner.de
http://www.joachim-breitner.de/
_______________________________________________
ghc-steering-committee mailing list
ghc-steering-committee@haskell.orgmailto:ghc-steering-committee@haskell.org
https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee