-
Notifications
You must be signed in to change notification settings - Fork 11
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
Encodes can't control their own quoting #16
Comments
Seconded. I would love to be able to only quote strings (potentially) containing commas. Integers and floats in my world need not be quoted. Ditto for dates. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Decodes can work with spacing and quoting information - for example, using
raw
it is possible to write a decoder which only succeeds when its input is quoted.The inverse is not true of Encodes. An encode cannot specify its own spacing or quoting. Currently this is set uniformly and applied to the encoding process as a whole.
I've been contacted with a request to support an Encode of type
Encode (Maybe ByteString)
with the following behaviour:In the case of
Nothing
, produce an empty, unquoted field. In the case ofJust x
, encode the ByteStringx
, surrounded by double double quotes. Even ifx == ""
. So in this CSV, the empty quoted field is semantically different to the empty unquoted field.Encoding should be changed so that this (and much more!) is possible. This will likely require some changes to the structure of
Encode
, so it would be preferable to write benchmarks for encoding before changing it.The text was updated successfully, but these errors were encountered: