purescript-arrays icon indicating copy to clipboard operation
purescript-arrays copied to clipboard

Does Array.index need to be a foreign import?

Open natefaubion opened this issue 1 year ago • 0 comments

The logic of Array.index can be implemented in terms of length and unsafeIndexImpl. Is it necessary for it to be foreign? In backend-optimizer, I'm preparing a change to inline the bounds check so that the Just allocation can be eliminated in some cases. If index bounds checking was implemented in PureScript rather than FFI, this would just work.

natefaubion avatar Jul 03 '23 18:07 natefaubion