Ticket #3895 (new feature request)

Opened 3 years ago

Last modified 8 months ago

"Fix" pervasive-but-unnecessary signedness in GHC.Prim

Reported by: pumpkin Owned by:
Priority: low Milestone: 7.6.2
Component: Compiler Version:
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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?

Change History

Changed 3 years ago by igloo

  • milestone set to 6.14.1

Changed 3 years ago by ross

  • type changed from proposal to feature request

Changed 2 years ago by igloo

  • milestone changed from 7.0.1 to 7.0.2

Changed 2 years ago by igloo

  • milestone changed from 7.0.2 to 7.2.1

Changed 20 months ago by igloo

  • milestone changed from 7.2.1 to 7.4.1

Changed 16 months ago by igloo

  • priority changed from normal to low
  • milestone changed from 7.4.1 to 7.6.1

Changed 8 months ago by igloo

  • milestone changed from 7.6.1 to 7.6.2
Note: See TracTickets for help on using tickets.