These are chat archives for nrinaudo/kantan.csv

26th
Jan 2017
Andrew Roberts
@aroberts
Jan 26 2017 21:39
hey @nrinaudo, how difficult would it be to extends automatic decoding to allow the client to specify the field order, but not have to specify the signature?
following your Car generic example, a decoder like
 implicit val carDecoder = RowDecoder.deriveDecoder[Car](0,3,2,1,4)
(I’m secretly hoping that you already implemented this and the generic docs are just a little out of date)
Nicolas Rinaudo
@nrinaudo
Jan 26 2017 22:33
@aroberts it would be pretty complicated, but that's not stopped me before. I'd need to give this some thought
that being said, it's not much more convenient than the existing tool for this purpose:
implicit val carDecoder = RowDecoder.decoder(0, 3, 2, 1, 4)(Car.apply _)
what bothers you about that? The fact that you need to specify the constructor by hand?
(the main problem that I see with what you request is that shapeless works at compile time, where your 0, 3, 2, 1 and 4 values only exist at runtime)
Nicolas Rinaudo
@nrinaudo
Jan 26 2017 22:48
Come to think of it, you might need to type-annotate carDecoder: RowDecoder[Car]. I'd argue that it's good practice anyway :)