The ContravariantShow instances for Duration and FiniteDuration are ambiguous. Thus, it is not possible to summon a ContravariantShow[FiniteDuration]. This also makes FiniteDuration unusable with the show"..." string interpolation.
[error] ....scala:10:13: ambiguous implicit values:
[error] both value catsStdShowForDuration in trait DurationInstances of type => cats.Show[scala.concurrent.duration.Duration]
[error] and value catsStdShowForFiniteDuration in trait FiniteDurationInstances of type => cats.Show[scala.concurrent.duration.FiniteDuration]
[error] match expected type cats.Show.ContravariantShow[scala.concurrent.duration.FiniteDuration]
[error] implicitly[cats.Show.ContravariantShow[FiniteDuration]]
[error] ^
yeah, this is tricky. We wanted show"..." to work when Show instance of supertype is available, but obviously, the variance is causing trouble when instances for both parent and child are defined.
One solution I can think of is that we add a new show_"..." that only takes Show.
It might be tricky to do in binary-compatible way (although I think that it might be able to be done), but one possible solution is to put the Duration and FiniteDuration instances into the same trait so that we can prioritize the two instances.
@ceedubs I think it's worth a try. and it should be easy to keep BC by just removing the implicit from old ones.
I would have some time. I could have a look if that's ok.
Most helpful comment
I would have some time. I could have a look if that's ok.