Closed brndt closed 7 months ago
I've created a small snippet with the error: https://scastie.scala-lang.org/zaCPhdkuTUyrzT0A8QX9KQ
Hey! Thanks for the report and the reproduction :smile: I'm afraid the asInstanceOf
call working before was just a stroke of luck. The good news is that you can easily get rid of it by tinkering with the traverseCollection
impl:
def traverseCollection[A, B, AColl <: Iterable[A], BColl <: Iterable[B]](
collection: AColl,
transformation: A => IO[E, B]
)(using factory: Factory[B, BColl]): IO[E, BColl] = ZIO.foreach(collection)(transformation.apply).map(factory.fromSpecific)
Here's the scastie snippet but with that change applied: https://scastie.scala-lang.org/1AQtvFdXQH24JYvsQRXpAw
...and after running it it evaluates to: PlayerStats(test,test,test,Map(1 -> TournamentStats(Map(f5f746e6-3699-4c82-b3f3-cd92cf6438fc -> Stats(1,2,3,4,5)))))
which I think is what you'd expect.
When trying to update the library version to 0.2 I have an error
Now I have
traverseCollection
implemented as:Before the migration it was implemented in this way:
Any suggestion what could be the problem? I can also pass A and B objects structure if it can help.