[Haskell-cafe] implementing a csv reader

Daan Leijen Daan at microsoft.com
Tue Aug 22 11:59:40 EDT 2006


> > 2. I am looking for a parser, but I don't know Haskell parsers.  Is
> >    Parsec a good choice?
>
> Parsec is definitely a good choice, but beware that it parses the whole
> input before returning, thus it may consume a huge batch of memory. As
> CSV is a line oriented format, you should make your parser lazy. Search
> the mailing list archive for "lazy parser".

A good trick here is to first use "lines" to break up the input into lines and than map a Parsec parse for each line to those lines (returning a list of Maybe a or ParseError a results).

All the best,
-- Daan.

> Regards,
>
> Jens
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list