-
Notifications
You must be signed in to change notification settings - Fork 11
Description
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.