"Fix" pervasive-but-unnecessary signedness in GHC.Prim
I'm talking about the array primitives in particular:
writeFloatArray# :: MutableByteArray# s -> Int# -> Float# -> State# s -> State# s
Conceptually, a Word# makes more sense as the index for all the array functions. I'm not even sure what the semantics are if the Int# is negative... is it checked? The three scenarios I can think of are:
Negativity is checked, and you get an exception. Negativity is unchecked, and you get to write to memory that comes before your array. Negativity is ignored, and the back-end treats the Int# like a Word# already.
I think the switch would be worthwhile in all of those cases, and could be hidden in higher-level APIs that still use Int for indexes with a simple int2Word#. Eventually we might even migrate to Word-based APIs at that level?