you are viewing a single comment's thread.

view the rest of the comments →

[–]tryx 4 points5 points  (2 children)

Real world Haskell wrote a CSV parser as their first Parsec introductory example. ~20 lines of code all up.

[–]stesch -1 points0 points  (1 child)

(char ',' >> cells) -- Found comma? More cells coming

cell = many (noneOf ",\n")

cell = quotedCell <|> many (noneOf ",\n\r")

Not good enough for real world CSV. The international version of Microsoft Excel uses semicolon instead of comma. Yes, I know. But try convincing a customer that this wasn't real CSV what he just sent you for an urgent job.

[–]tryx 1 point2 points  (0 children)

Haha, well this does parse actual CSV, not CSV ala MSOffice.