These are chat archives for nrinaudo/kantan.csv

18th
Nov 2016
Eugene Apollonsky
@chessman
Nov 18 2016 07:36 UTC
@nrinaudo that's really strange. I created a repro project: https://github.com/chessman/kantan.csv-test
 kantan.csv-test git:(master) ✗ sbt compile
[info] Loading global plugins from /home/ea/.sbt/0.13/plugins
[info] Set current project to kantan.csv-test (in build file:/home/ea/src/kantan.csv-test/)
[info] Updating {file:/home/ea/src/kantan.csv-test/}kantan-csv-test...
[warn] Binary version (2.10) for dependency org.scala-lang#scala-compiler;2.10.6
[warn]     in default#kantan-csv-test_2.11;0.1-SNAPSHOT differs from Scala binary version in project (2.11).
[warn] Binary version (2.10) for dependency org.scala-lang#scala-library;2.10.6
[warn]     in default#kantan-csv-test_2.11;0.1-SNAPSHOT differs from Scala binary version in project (2.11).
[warn] Binary version (2.10) for dependency org.scala-lang#scala-reflect;2.10.6
[warn]     in default#kantan-csv-test_2.11;0.1-SNAPSHOT differs from Scala binary version in project (2.11).
[warn] Binary version (2.10) for dependency org.scala-lang#scalap;2.10.6
[warn]     in default#kantan-csv-test_2.11;0.1-SNAPSHOT differs from Scala binary version in project (2.11).
[info] Resolving org.scala-lang#scalap;2.10.6 ...
[info] Done updating.
[info] Compiling 1 Scala source to /home/ea/src/kantan.csv-test/target/scala-2.11/classes...
[error] /home/ea/src/kantan.csv-test/src/main/scala/org/example/Application.scala:9: could not find implicit value for parameter ea: kantan.csv.RowEncoder[org.example.A]
[error]   List(A(3)).asCsv(',')
[error]                   ^
[error] one error found
Nicolas Rinaudo
@nrinaudo
Nov 18 2016 08:21 UTC
ok, so you're not dreaming, there's something dogy happening
I'll need to look into it, but today looks like a nightmare, so I probably won't have a fix as quickly as you might hope
@chessman I do have an easy workaround though - not satisfactory, but at least it'll work. Add this to your code:
object A {
  implicit val rowEncoder = kantan.csv.RowEncoder[A]
}
Nicolas Rinaudo
@nrinaudo
Nov 18 2016 08:27 UTC
ah crap.
Ok, I think I know what the problem is, and unfortunately, it's not mine
ok, I can't find the specific scala issue anymore, I'll look for it some more if you want me to, but there's something dodgy with scope and order of implicits when in the same file
so in your case, to sort the problem, just declare A within Application and everything compiles
Nicolas Rinaudo
@nrinaudo
Nov 18 2016 08:33 UTC
I'll still look into this a bit further, my gut feeling might be wrong
So yeah, #65. Thanks for reporting this!
Eugene Apollonsky
@chessman
Nov 18 2016 08:38 UTC
ok, thanks for help!
Nicolas Rinaudo
@nrinaudo
Nov 18 2016 08:39 UTC
no, thank you. It's easy to find this kind of issue and dismiss the entire library as bug-ridden. I appreciate that you took the time to report it and give me a chance to improve kantan.csv
Nicolas Rinaudo
@nrinaudo
Nov 18 2016 20:26 UTC
@chessman ok, so the bug you reported is really, really weird. It has to do with default parameters somehow having an impact on implicit resolution (!?!).
long story short, it's a bug, I think I know how to work around it and it should make it to 0.1.16. Thanks!
Nicolas Rinaudo
@nrinaudo
Nov 18 2016 20:51 UTC
@chessman fixed in 0.1.16-SNAPSHOT, if you want to give that a go. Don't forget to add the sonatype snapshot resolver to your build:
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies += "com.nrinaudo" %% "kantan.csv-generic" % "0.1.16-SNAPSHOT"