A Combination of Lists, Case Classes and Tuples does not compile.
See original GitHub issueA simple combination of Lists, Cases Classes and Tuples does not compile. I see no reason, why it shouldn’t work. I minimized the example as far as i could. Note that it compiles when we remove one of the lists or change the tuple-type to a single Double or a Case Class.
case class A(fills: List[B])
case class B(stops: List[(Double,Double)])
boopickle.Unpickle[A].fromBytes(null.asInstanceOf[ByteBuffer])
compileroutput with boopickle 1.0.0:
[error] C:\Users\florian.kirmaier\Dropbox\git\file.scala:32: Can
not materialize pickler for non-case class: scala.collection.immutable.List
[error] boopickle.Unpickle[A].fromBytes(null.asInstanceOf[ByteBuffer])
[error] ^
[error] one error found
[error] (scalaServer/compile:compile) Compilation failed
[error] Total time: 59 s, completed Jun 23, 2015 11:52:35 AM
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Convert an Option of a case class into a tuple of its elements
1 Answer 1 ... The simple answer to your question is "no", your code is pretty much as good as it gets. Scala...
Read more >Tuples bring generic programming to Scala 3
HLists and case classes can both be used to define products of types. However HLists do not require the developer to declare class...
Read more >itertools — Functions creating iterators for efficient looping ...
The combination tuples are emitted in lexicographic ordering according to the order of the input iterable. So, if the input iterable is sorted,...
Read more >9. Objects, Case Classes, and Traits - Learning Scala [Book]
The scala command will execute the contents of your file as if they were entered in a REPL, but you don't end up...
Read more >Python Tuples Tutorial - DataCamp
Tuples versus Lists · You can't add elements to a tuple because of their immutable property. · You can't remove elements from a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks to @cornerman and @ochrons ! There is a perfect solution for this problem now!! Just simply add
boopickle-shapelessto your project!!This is the code for the test above:
It’ll return the complication error:
To solve it, add this to scala project:
And then simply change
import boopickle.Default._toimport boopickle.shapeless.Default._!More details in #89 and codes are here.
I encountered this when doing some refactoring. All I did was to remove a type parameter from something so it was looking for
Pickler[Thing[A]]instead ofPickler[Thing[_, A]]. My guess is that the existential type was somehow preventing the implicit divergence although I haven’t been able to replicate that.The workaround in my case was to hide the
iterablePicklerand themapPickler:Then explicitly declare the collections I need:
I feel like there is more to this bug than just it being a “known limitation of the macro/implicit system”. I’ve never encountered so many weird cases where this bug pops up with other libraries. There are tons of tiny little things that either make this error appear or go away. It is definitely related to higher-kinded types but there are also some other oddities in there too.
You can see a bunch of things I found here https://gist.github.com/steinybot/e8710f6ff40379bf2d0f2767b5784fd4.