-
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
RFC: a type to attempt parsing #146
Comments
How is this different from just using |
There is an |
I'm a bit confused. Your |
You can make a row level instance of it as well.
On Wed, 5 Jul. 2017, 11:37 pm Max, ***@***.***> wrote:
I'm a bit confused. Your Try is at the column level not row level, so I'm
not sure which error message you get at the row level .
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#146 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAwXc8ML5OYZ-HXkytAWXrazeCuGbhrTks5sK5GhgaJpZM4OHgS4>
.
--
Ivan Miljenovic
On mobile; please excuse any tpyos
|
What I mean, I have similar problems and the way I do to have row parametrized by a functor
What I parse (and declare as a FromRecord instance) is |
My use-case was for having fields that were meant to have specific textual values (hence why I referenced the example I wasn't aware of the So in practice I have a bunch of TL;DR: I want error messages; to use |
In my (internal) codebase, I've just written this type:
The intent is for fields that may not match a specified format; e.g. the documentation for
FromField
has an example of aColor
type. In practice, if this is in the middle of a row, then parsing that row fails, and thus parsing an entire CSV file can fail.Whilst the type can be wrapped with a
Maybe
, this has two unfortunate side-effects:As such, this wrapper type allows you to successfully parse a file, and then discard rows which did not actually succeed (logging errors, etc.).
If we add in the attempted field into the
Left
case, we can then use that forToField
and thus have the round-trip property. We can similarly also apply this to theFromRow
/ToRow
case to be able to discard rows that cannot succeed (especially useful for streaming scenarios).Do you think this is a useful enough type for me to send a PR? What should the name be?
The text was updated successfully, but these errors were encountered: