-
Notifications
You must be signed in to change notification settings - Fork 52
parsing failure context label #96
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
-- | If parsing fails inside this labelled context, then prepend the `String` | ||
-- | to the error `String` in the `ParseError`. | ||
label :: forall m s a. Monad m => String -> ParserT s m a -> ParserT s m a | ||
label messagePrefix p = catchError p $ \ (ParseError message pos) -> |
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.
Is there value in appending with a space by default, or should that be left to the user?
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 good question. I say leave it to the user, who might reasonably choose to append " "
or "\n"
or something else.
I don't have an opinion on which of those names is used for the function, but another maintainer may. If you think that |
Oh now I remember why I thought the name |
I'm going to go ahead and merge this, but if you would like to revisit the name prior to the next release of the library then please feel free to open an issue / PR. Thanks! |
Cool I think it's good the way it is, thank you @thomashoneyman |
I just realized that this should be label :: forall m s a. Monad m => (ParseError -> ParseError) -> ParserT s m a -> ParserT s m a So that the user can do whatever they want to the Also probably better for performance, since the |
I haven’t released anything yet — I’m on board, want to make this update? |
Oh hi! Ok, I'll make the update. |
What does this pull request do?
Resolves #95
Also, in a separate commit, add a link in the README to purescript-parsing-dataview, as offered by @garyb #88 (comment)
Where should the reviewer start?
There is one function added, and one test.
How should this be manually tested?
pulp --psc-package test