I did a small search for parsing a comma seperated file in Haskell and didn't
find anything-- so I put together some code to do this. It doesn't handle
whitespace very well, this would be a nice addition if someone has an idea
out there. Also the rows method, I had trouble just using two do
Shawn P. Garbett wrote:
I did a small search for parsing a comma seperated file in Haskell and didn't
find anything--
I threw one together a while ago:
http://www.xoltar.org/languages/haskell/CSV.hs
which isn't much different than your example, though it does handle
nested quotation marks.
Nevermind the previous version, I've solved a few bugs in it (like unquoted
numbers and correctly handling blank fields).
1. Any string without commas or newlines can be unquoted; no need to restrict it to
digits.
2. In a quoted string, (that is, two double quotes) stands for one double
Hey, I wrote a CSV parser too. seeing as how this seems like a common
thing (having 3 independent implementations at least), perhaps it
belongs in libraries somewhere? some area dedicated to useful little
grammers would be handy. csv, c header files, .x (rpcgen), various
preference file formats,
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 29 July 2003 01:40 pm, John Meacham wrote:
Hey, I wrote a CSV parser too. seeing as how this seems like a common
thing (having 3 independent implementations at least), perhaps it
belongs in libraries somewhere? some area dedicated to
perhaps something like 'vim.sf.net's script section. where anyone can
post a script (or haskell file). and everyone can immediatly see and
download it. the good ones filter to the top, and since the individual
files don't need to be part of a larger library infrastructure there is
much more