-
Notifications
You must be signed in to change notification settings - Fork 30
Is it possible to use semi-auto with recursive structures? #463
Comments
Hi, Below seems to work for me (for all supported scala versions): sealed trait T
object T {
implicit val tdiff: Diff[T] = Diff.derived[T]
}
case class Ts(ts: List[T]) extends T It seems that specifying variable type is sufficient to make magnolia macro happy. Let me know if this also helps in your case. btw. I am going to put diffx into a maintenance mode soon (I should've done this long time ago). I don't have time and energy to maintain this project anymore, and there is quite a good alternative for it - https://github.com/jatcwang/difflicious |
Huh -- I thought I had tried that, but maybe not. I'll give that a try -- thanks!
Ahhh -- okay, that's good to know now. I'm in the process of spinning up a major new test harness at work, but am only a little ways into using Diffx (I just hit a particularly complex comparison problem yesterday), so it sounds like I should try to pivot to difficilious. Thanks for the heads-up! |
@ghostbuster91 maybe I'll archive the project then? would be great to see it going, but resources are limited |
@adamw If you do so, please leave a prominent forwarding pointer at the docs location (and in the README) to diffilicious -- it's enormously helpful for us users to have the recommendation for an alternative. |
@ghostbuster91 makes sense, thanks :) |
(Phrasing this as a question, because I don't know if this is already possible, or whether this is an enhancement suggestion.)
Given this trivial code:
I can use full auto to derive a
Diff
, but it's extremely slow. I would like to be able to use semi-auto, to bring down compilation time, like this:but that fails with complaints from Magnolia, and I can't for the life of me find a variation that gets past them. I've tried spelling out various combinations of explicit
derived
calls, using low-priority traits and all, but each one trips up on the Magnolia macros.(My actual use case is much, much more complex -- nested sealed traits with various recursive sub-classes -- but this seems to be the nub of the issue: I can't even figure out how to get past the starting line here.)
I really like Diffx, and would like to use it, but the compilation time for auto-derivation is problematic enough (presumably because of the complexity of the structure) that it may turn into a blocker for us. So I'm hoping that there's a way to make semi-auto work for recursive structures.
The text was updated successfully, but these errors were encountered: