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

Remove bounds check and exception from Data.String.Unsafe foreign code?

Open natefaubion opened this issue 1 year ago • 3 comments

I think the bounds check and the exception are largely unnecessary. Presumably one would be using these APIs if they had already performed the requisite checks. If one wanted an exception (rather than undefined behavior), then there is unsafeJust on the safe API.

natefaubion avatar Apr 26 '24 21:04 natefaubion

I don't see Data.Char.Unsafe. Did you mean Data.String.Unsafe?

michaelficarra avatar May 01 '24 17:05 michaelficarra

Yes, sorry.

natefaubion avatar May 01 '24 17:05 natefaubion

This sounds good. Also, this will allow us to redefine char as export const char = charAt(0);.

michaelficarra avatar May 01 '24 17:05 michaelficarra