Conversation
|
We can close purescript/purescript-strings#155 once this PR gets merged |
|
Nice, I will look at this. |
jamesdbrock
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
indexOfanyDigit,anyLetterand derivatives use the CodeUnit version ofanyCharfor speed