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

Encodes can't control their own quoting #16

Open
gwils opened this issue Mar 27, 2018 · 1 comment
Open

Encodes can't control their own quoting #16

gwils opened this issue Mar 27, 2018 · 1 comment

Comments

@gwils
Copy link
Member

gwils commented Mar 27, 2018

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 of Just x, encode the ByteString x, surrounded by double double quotes. Even if x == "". 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.

@dmvianna
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants