Skip to content

Encodes can't control their own quoting #16

@gwils

Description

@gwils

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions