Open keiSunagawa opened 4 years ago
No reason other than I forgot, I'm afraid. I'll fix that in a future release, but that doesn't help you right now.
If you've already dug through the code enough to reach kantan.codecs, you probably worked out the workaround for yourself, but just in case: you can provide your own CellDecoder[LocalDate]
by grabbing the StringDecoder[LocalDate]
, contramapping a trim
into it and tagging it to the right phantom type.
thanks. I will try 👍
Reopening because I do want to fix this properly :)
Hello! Sorry to come here for support. I'm facing a similar issue with an enumeratum and I'm trying to implement a similar workaround.
I succeeded by changing the string decoder globally, but that's not what I really want.
My two questions are:
Thanks a lot!
Cheers
Well, implicitly
allows you to summon implicit values, such as:
implicitly[StringDecoder[LocalDate]]
Decoders are tagged with a type - kantan.csv.codecs
for CSV decoders, so to turn a StringDecoder[LocalDate]
into a CellDecoder[LocalDate]
, you can call .tag[kantan.csv.codecs]
.
this code become to decode error.
CellDecoder[LocalDate] can only parse for
a,2019-10-12
ora, "2019-10-12"
.but, CellDecoder[Long] can parse for
a, 123
, because StringCodec[Long] call toString#trim
ref https://github.com/nrinaudo/kantan.codecs/blob/master/core/shared/src/main/scala/kantan/codecs/strings/codecs.scala#L234why do not apply some solution for LocalDate?