Skip to content
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

Get YamlMark instances for all events in Text.Libyaml #157

Closed
afranchuk opened this issue Sep 27, 2018 · 2 comments
Closed

Get YamlMark instances for all events in Text.Libyaml #157

afranchuk opened this issue Sep 27, 2018 · 2 comments

Comments

@afranchuk
Copy link

afranchuk commented Sep 27, 2018

Having the source location of events within Text.Libyaml is useful for printing error/warning messages related to documents. If the marks are available, the Data.Yaml ParseException constructors could (possibly) include the mark related to the monad failure. I haven't looked in depth into the way the Aeson bindings have been done, so maybe that's not possible. But adding location information to errors in Data.Yaml.Parser should be possible. Having the marks in Text.Libyaml would be the minimum necessary to meet what I need (according to the libyaml documentation, start_mark and end_mark attributes are available for all events).

@snoyberg
Copy link
Owner

To start: I'd be open to a PR to Text.Libyaml to add new decoding functions which return the YamlMark together with the Event.

@afranchuk
Copy link
Author

Yeah, I may have a PR in the not-too-distant (1-2 months) future. I don't immediately need the functionality, but I will.

afranchuk pushed a commit to afranchuk/yaml that referenced this issue Oct 8, 2018
Adds decodeMarked and decodeFileMarked functions.
snoyberg added a commit that referenced this issue Oct 10, 2018
Close #157. Return start and end marks for all events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants