-
Notifications
You must be signed in to change notification settings - Fork 20
Use slices instead of cursors #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We can close purescript/purescript-strings#155 once this PR gets merged |
Nice, I will look at this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a breaking change, besides changing the names of the record fields in PosString
?
Nothing -> Left { pos, error: "CodePoint " <> show cp <> " is not a character" } | ||
Nothing -> Left { pos, error: "Unexpected EOF" } | ||
Just chr -> Right { result: chr, suffix: { substring: SCP.drop 1 substring, position: position + 1 } } | ||
Nothing -> Left { pos: position, error: "CodePoint " <> show cp <> " is not a character" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So here we're in the CodePoints parser, but I think this says that any astral CodePoint is not allowed? Is that what we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean it's true that because this parser returns Char
there is no way for it to parse an astral CodePoint.
But I think this will surprise and confuse people? Maybe the CodePoints parsing module should not include this parser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree with you. I'm in favour of exporting an anyCodePoint instead or something in this module. I think the Char type is not a useful abstraction in PureScript (at least, it shouldn't be), but perhaps we should also keep supporting the anyChar parser as long as Char is a thing? I think it also depends on what direction purescript/purescript#3662 is taking.
Because the Parser type has changed and it is part of the public API of this package. If people have written a parser in terms of this definition, their code will have to be adjusted. Or does that not qualify as a breaking change? |
Sure, that makes sense. But the only thing that has changed about the type of the If it were up to me, I think I would do the work you've already done, and then also
|
Yes I'll make an issue for anyCodePoint |
Proof of concept to fix #77. This change would be breaking because it changes the underlying representation.
indexOf
anyDigit
,anyLetter
and derivatives use the CodeUnit version ofanyChar
for speed