parseCSV "name" . printCSV not idempotent

Antoine Latter aslatter at gmail.com
Mon Nov 8 15:23:33 EST 2010


It is true, the fix may belong in CSV. I am recovering from my tendencies to
go through contortions to work around issues that I could be solving at
their source.

Does CSV use line/unlines under the hood? I have heard that these do not
perfectly round-trip.

Antoine
On Nov 8, 2010 1:33 AM, "Joachim Breitner" <mail at joachim-breitner.de> wrote:
> Hi,
>
> Am Sonntag, den 07.11.2010, 19:52 +0100 schrieb Antoine Latter:
>> On Sun, Nov 7, 2010 at 10:43 AM, Joachim Breitner
>> <mail at joachim-breitner.de> wrote:
>> > Hi Jaap,
>> >
>> > your CSV library is used in the Hackage2 project. I found that backup
>> > and restore does not work with a pristine state, and the reason seems
to
>> > be a problem with your library: It either adds unnecessary newlines or
>> > interprets empty lines at the end of the program for no apparent
reason:
>> >
>> > Prelude Text.CSV> (parseCSV "name" . printCSV) []
>> > Right [[""]]
>> > Prelude Text.CSV> (parseCSV "name" . printCSV) [[]]
>> > Right [[""],[""]]
>> > Prelude Text.CSV> (parseCSV "name" . printCSV) [[],[]]
>> > Right [[""],[""]]
>> > Prelude Text.CSV> (parseCSV "name" . printCSV) [["hi"],["ho"]]
>> > Right [["hi"],["ho"],[""]]
>> > Prelude Text.CSV> (parseCSV "name" . printCSV) [["hi"]]
>> > Right [["hi"],[""]]
>> > Prelude Text.CSV>
>> >
>>
>> At some point I had a hack in place to drop the last row of a parsed
>> CSV file if it was nothing but an empty string. It may have gotten
>> lost, or it may not be universally applied in hackage-server 2. This
>> worked pretty well for most things, but I don't think I ever ran into
>> the issue of an empty line in the middle of a CSV file.
>
> correct, I later found that code as well. I’m not fully anymore that the
> issues I observed are caused by this bug. But nevertheless it’s better
> to fix the CSV module than work around it in hackage2.
>
> Greetings,
> Joachim
>
> --
> Joachim "nomeata" Breitner
> mail: mail at joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
> JID: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/
> Debian Developer: nomeata at debian.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/cabal-devel/attachments/20101108/6454fb41/attachment.html


More information about the cabal-devel mailing list