-
Notifications
You must be signed in to change notification settings - Fork 107
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
Per-line parser reporting per-line errors #210
Comments
Yeah, that is thinkable. cassava/src/Data/Csv/Parser.hs Lines 69 to 75 in c821c83
uses the parser modifier sepByEndOfLine' :cassava/src/Data/Csv/Parser.hs Lines 92 to 105 in c821c83
So, it is just a single parse with a single error returned. If you want per-line parsing, you will first have to split the input using a variant of sepByEndOfLine' and then map a line parser over it.
PR welcome, if it comes with benchmarks comparing the performance of single parse versus per line parse. |
Ok, I'm not interested in the performance implications of this, so just going to close |
Let's leave it open, maybe others are interested. |
Right now, the functions in Data.Csv generally return
Either String (Vector a)
or a similar variant, which is great in most cases.If you want to get errors on a per-line basis, one needs to use Data.Csv.Incremental*. This is unfortunate because the complexity of it is significantly higher (because it also is supporting interleaving IO and incrementally feeding data to the parser).
I think adding convenience functions for taking a ByteString and returning
Vector (Either String a)
, without going through theIncremental
functions, could be a good addition. The main use case I have in mind for those is providing better error messages for user-provided CSVs.The text was updated successfully, but these errors were encountered: