Skip to content

CodePoints uncons? Deprecate drop? #109

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

Closed
jamesdbrock opened this issue Feb 7, 2021 · 8 comments · Fixed by #119
Closed

CodePoints uncons? Deprecate drop? #109

jamesdbrock opened this issue Feb 7, 2021 · 8 comments · Fixed by #119

Comments

@jamesdbrock
Copy link
Member

I just noticed that instance stringStringLike uses CodeUnits for uncons.

instance stringLikeString :: StringLike String where
uncons = SCU.uncons
drop = S.drop

Doesn't that mean that anyChar will be wrong for astral characters?

anyChar = do
input <- gets \(ParseState input _ _) -> input
case uncons input of

Also, the drop member of StringLike is now unused?

@drathier
Copy link

I just hit the anyChar issue you found above, but with the purerl backend.

@jamesdbrock
Copy link
Member Author

I'm looking through the code for this package and basically the whole thing is completely oriented to UTF-16 codeunits...

@jamesdbrock
Copy link
Member Author

You might try using this instead @drathier https://pursuit.purescript.org/packages/purescript-string-parsers

@drathier
Copy link

The problem is that https://pursuit.purescript.org/packages/purescript-string-parsers/6.0.1/docs/Text.Parsing.StringParser.CodePoints#v:anyChar puts the result into a Char so it isn't parsing code points after all. we'll be writing our own anyCodePoint and anyGrapheme later today.

@jamesdbrock
Copy link
Member Author

@jamesdbrock
Copy link
Member Author

@drathier I'd like to see your anyGrapheme parser. Link please? Do you think that this library should include anyGrapheme?

@jamesdbrock
Copy link
Member Author

@drathier Would PR #119 solve your problem? That PR deletes the StringLike class. Would you like to rely on that class for purerl? Or have your implemented the Data.String API for purerl?

@jamesdbrock
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants