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

Line numers & column numbers #48

Open
Profpatsch opened this issue Aug 2, 2021 · 1 comment
Open

Line numers & column numbers #48

Profpatsch opened this issue Aug 2, 2021 · 1 comment

Comments

@Profpatsch
Copy link

I noticed that the parse errors contain neither line numbers nor column numbers (assigning a decoding error to a column).

The first can be easily circumvented by parsing the file line-by-line, and keeping track of which line we are in.
The second is baked into sv, due to the fact how it accumulates errors into a Semigroup of DecodeError;

I think column errors could be added by putting them into BadParse, however they only really make sense if you are parsing line-by-line; however, if you are not doing that, the resulting errors will be pretty useless anyway, because there won’t be any underlying position for BadParses, and you just get a structureless list. I feel like this is a architectural problem with sv though.

@Profpatsch
Copy link
Author

My use-case here is to display reasonable human-readable errors for decode problems.

For example, cassava-megaparsec has this feature, it uses a feature of megaparsec to provide decoding errors at the right line numbers: https://hackage.haskell.org/package/cassava-megaparsec-2.0.2/docs/Data-Csv-Parser-Megaparsec.html#t:ConversionError

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

1 participant