<div dir="ltr"><div><div><div><div><div>I propose that we accept <a href="https://github.com/ghc-proposals/ghc-proposals/pull/121" rel="noreferrer" target="_blank">https://github.com/ghc-<wbr>proposals/ghc-proposals/pull/<wbr>121</a><br></div><div>With one modification (below).<br></div><div><br>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:<br><br>shrinkArray# :: MutableArray# s a -> Int# -> State# s -> State# s<br>resizeArray# :: MutableArray# s a -> Int# -> a -> State# s -> (# State# s, MutableArray# s a #)<br><br></div><div>(these mirror the existing shrink and resize primitives we have for ByteArray#, with the same rationale)<br></div><div><br></div><div>The biggest downside is that we currently have<br>  <br>  sizeOfMutableArray# :: MutableArray# s a -> Int #<br><br></div><div>which would need to be replaced by a stateful operation<br></div><div><br>  getSizeOfMutableArray# :: MutableArray# s a -> State# s -> (# State# s, Int# #)<br><br></div><div>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:<br><br>sizeofMutableArray :: MutableArray s a -> Int<br></div><div><br></div><div>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.<br></div><div><br></div>Suggested modifications:<br></div>* Remove the ArrayArray# primitives, add UniftedArray# primitives instead (see <a href="https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0021-unlifted-array.rst">https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0021-unlifted-array.rst</a>)<br></div><br></div>Cheers<br></div>Simon<br><br><div><div><div><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On 1 May 2018 at 13:12, Joachim Breitner <span dir="ltr"><<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Committee,<br>
<br>
this is your secretary speaking:<br>
<br>
Array resizing primitives have been proposed by David Feuer:<br>
<a href="https://github.com/ghc-proposals/ghc-proposals/pull/121" rel="noreferrer" target="_blank">https://github.com/ghc-<wbr>proposals/ghc-proposals/pull/<wbr>121</a><br>
<br>
I propose Simon Marlow as the shepherd.<br>
<br>
Simon, please reach consensus as described in<br>
<a href="https://github.com/ghc-proposals/ghc-proposals#committee-process" rel="noreferrer" target="_blank">https://github.com/ghc-<wbr>proposals/ghc-proposals#<wbr>committee-process</a><br>
<br>
I suggest you make a recommendation, in a new e-mail thread with the<br>
proposal number in the subject, about the decision, maybe point out<br>
debatable points, and assume that anyone who stays quiet agrees with<br>
you.<br>
<br>
Thanks,<br>
<span class="gmail-HOEnZb"><font color="#888888">-- <br>
Joachim Breitner<br>
  <a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a><br>
  <a href="http://www.joachim-breitner.de/" rel="noreferrer" target="_blank">http://www.joachim-breitner.<wbr>de/</a><br>
</font></span><br>______________________________<wbr>_________________<br>
ghc-steering-committee mailing list<br>
<a href="mailto:ghc-steering-committee@haskell.org">ghc-steering-committee@<wbr>haskell.org</a><br>
<a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" rel="noreferrer" target="_blank">https://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/ghc-<wbr>steering-committee</a><br>
<br></blockquote></div><br></div></div></div></div></div></div></div></div>