title: Read CSV in Scala into case class instances with error handling
body: <p>I would like to read a CSV String/File in Scala such that given a case class <code>C</code> and an error type <code>Error</code>, the parser fills an <code>Iterable[Either[Error,C]]</code>. Is there any library that does this or something similar?</p>
  
  <p>For instance, given a class and error</p>
  
  
  
  <pre><code>case class Person(name: String, age: Int)
  
  type Error = String
  </code></pre>
  
  <p>and the CSV String</p>
  
  <pre><code>Foo,19
  Ro
  Bar,24
  </code></pre>
  
  <p>the parser would output</p>
  
  
  
  <pre><code>Stream(Right(Person("Foo",1)), Left("Cannot read 'Ro'"), Right(Person("Bar", 24)))
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>I think my question wasn't clear, so let me clarify: is there a way read CSV in Scala without defining boilerplate? Given <strong>any</strong> case class, is there a way to load it automatically? I would like to use it in this way:</p>
  
  
  
  <pre><code>val iter = csvParserFor[Person].parseLines(lines)
  </code></pre>