These are chat archives for nrinaudo/kantan.csv

19th
Mar 2017
Nicolas Rinaudo
@nrinaudo
Mar 19 2017 02:26
@hardmettle not really, or at least not cleverly or generically - B is a compound value and cannot have a CellDecoder, and it's used as a cell in A.
when this kind of scenario happens to me, however, I don't usually need a perfectly generic decoder for B - I just need a Decoder[A], and it's pretty easy to write something like:
implicit val aDecoder: RowDecoder[A] = RowDecoder.ordered((s: String, i: Int, i2: Int) => A(s, B(i, i2)))
Nicolas Rinaudo
@nrinaudo
Mar 19 2017 02:32
This assumes that your CSV contains the expected values at indexes 0, 1 and 2. If that's not the case, use decoder rather than ordered
Harsh Gupta
@hardmettle
Mar 19 2017 07:28
@nrinaudo Thanks for the help. Will take a look
Harsh Gupta
@hardmettle
Mar 19 2017 14:54
@nrinaudo @all One more help here . when reading CSV as case class getFileURL.asCsvReader[T](rfc.withHeader) How to do error handling as to the ReadResult sends a Failure when a field is missing in a record ?