[Haskell-cafe] Telling Cassava to ignore lines

2013-09-17 Thread Andrew Cowie
I'm happily using Cassava to parse CSV, only to discover that non-conforming lines in the input data are causing the parser to error out. let e = decodeByName y' :: Either String (Header, Vector Person) chugs along fine until line 461 of the input when parse error (endOfInput) at

Re: [Haskell-cafe] Telling Cassava to ignore lines

2013-09-17 Thread Johan Tibell
Hi, It depends on what you mean by doesn't parse. From your message is assume the CSV is valid, but some of the actual values fails to convert (using FromField). There are a couple of things you could try: 1. Define a newtype for your field that calls runParser using e.g. the Int parser and if

Re: [Haskell-cafe] Telling Cassava to ignore lines

2013-09-17 Thread Andrew Cowie
On Tue, 2013-09-17 at 19:03 -0700, Johan Tibell wrote: 2. Use the Streaming module, which lets you skip whole records that fails to parse (see the docs for the Cons constructor). Ah, that's sure to be it. Totally missed Data.Csv.Streaming. Thanks! AfC Sydney