Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Ghost
@ghost~540393fe163965c9bc2018ce
and same for coproduct
ok, great, that seems to have helped, but now I'm getting ambiguous implicits with Option when I add in the coproduct case and an instance for Option[T]
I'll update
Ghost
@ghost~540393fe163965c9bc2018ce
now there is ambiguous implicits for Option[String]
(I introduced an instance for Option[T] and the coproduct derivation)
adding a LowPriority to gen makes no difference
maybe the generic deriver should go on a low priority trait?
nope, no difference
so so close to generic derivation finally working the way I've always wanted :sob:
Miles Sabin
@milessabin
You've made the explicit instance for Option low-priority, ie. lower priority than the imported Generic instances.
Ghost
@ghost~540393fe163965c9bc2018ce
doing an explicit import Encoder.EncoderOption "solves" it, but it's hardly ideal
ok, I was just following the example in the export-hook I'll undo that
Miles Sabin
@milessabin
I don't think you are.
Ghost
@ghost~540393fe163965c9bc2018ce
oh awesome :sparkles:
you're quite right, I didn't read the comments closely enough
// Instances which should be higher priority than derived
I am so used to putting everything in LowPriority it didn't even occur to me to put them where they should be
must... unlearn... what I have learned
this is amazing
why are you unhappy with this approach, Miles?
this is far better than any other hack I've had to do
(I should check the rest of my test suite and code compiles before getting too excited...)
Miles Sabin
@milessabin
Conceptually it's OK, but the implementation leaves a lot to be desired.
Ghost
@ghost~540393fe163965c9bc2018ce
I guess it still breaks in IntelliJ too
or does it, maybe IntelliJ finds implicits fine, it just finds the wrong ones, but it doesn't matter
I wonder if I can get AnyVal working now
Miles Sabin
@milessabin
Compile times will blow out horribly because the only mechanism for implementing the priority ordering is it search for an implicit of the highest priority, then if that fail of the next, then the next and so on ...
Ghost
@ghost~540393fe163965c9bc2018ce
yeah, if IntelliJ even does it that way...
Miles Sabin
@milessabin
In the case where there really isn't an instance the time taken for the search to fail increases massively. Combine that with recursive implicit search and you're in fairly ugly territory compile time wise, even for stuff which does actually type check, because of the cost of exploring failing paths.
See the compile times for Kittens for an example.
It's been a useful proof of concept, but from an implementation PoV it's a dead end.
Ghost
@ghost~540393fe163965c9bc2018ce
hmm
Ghost
@ghost~540393fe163965c9bc2018ce
there is a null used somewhere in export-hook which is making wartremover complain, there is an easy fix I'll send a PR
Miles Sabin
@milessabin
Where?!?
Ghost
@ghost~540393fe163965c9bc2018ce
@exports adds it
it might just be repeating my null, to be fair
(for cnil)
Miles Sabin
@milessabin
Yes, it would be mirroring your definition.
Ghost
@ghost~540393fe163965c9bc2018ce
heh, now it complains about something without explicit implicits.
I'll have to dump out the post typer tree to see what's going on there, but it's an equally trivial fix
Ghost
@ghost~540393fe163965c9bc2018ce
hmm. I think I've found a regression, for type class hierarchies, it seems very easy to get the compiler to spin forever. It will take some time to create a minimisation.
Ghost
@ghost~540393fe163965c9bc2018ce
actually I think it was just working by mistake before. Now there is less clutter and I'm able to be a bit more specific about which subtypes I prefer
Ghost
@ghost~540393fe163965c9bc2018ce
nope, there's definitely still something funky going on. I have an implicit Encoder[Foo] on Foo's companion and then when I try to do cachedImplicit[Encoder[Foo]] somewhere else it compiles forever.
this seems to be about ordering or something, so it may not be possible to minimise
Ghost
@ghost~540393fe163965c9bc2018ce
ok, I found the conflict. I had a Not in there and somehow it causes generic derivation to trigger. weird.
now called Refute
lesson learnt, don't try to do anything fancy with typeclass hierarchies!!