<div>> Your code is broken in a most evil and insidious way.</div>
<div> </div>
<div>Interesting. This is for a toy project, so I'm not too worried, but lets say I wanted to do this "correctly" and I was set on using IOUArray for some reason. (The Haskell wiki claims that StorableArray is slower; is that actually the case?)
</div>
<div> </div>
<div>Which of the following fixes would work now? Which has the lowest probability of not working in the future?</div>
<div> </div>
<div>1) Declare f to take Addr# and don't construct a Ptr Word32</div>
<div> I suspect this would be enough unless the GC changed to some sort of continous GC which can happen even without an allocation</div>
<div> </div>
<div>2) Declare f to take MutableByteArray#</div>
<div> Is this good enough to make the collector happy?</div>
<div> </div>
<div>3) Something else I haven't thought of?</div>
<div> </div>
<div>If there was no other option, and StorableArray wasn't slower, and I was working on a real project, I'd probably wrap my own around ForeignPtr like Data.ByteString.</div>
<div> </div>
<div> -- ryan</div>
<div> </div>