-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid implicit resolution attempt for higher kind #10849
Comments
One workaround I came up with was to proxy the higher-kinded type class - scala> :paste
// Entering paste mode (ctrl-D to finish)
trait Field[A] {
def combine(x: A, y: A): A
def empty: A
}
object Field {
implicit def fromMonoidK[F[_], A](implicit F: MonoidK[F]): Field[F[A]] = new Field[F[A]] {
override def combine(x: F[A], y: F[A]): F[A] = F.combineK(x, y)
override def empty: F[A] = F.empty
}
}
// Exiting paste mode, now interpreting.
defined trait Field
defined object Field
scala> object polyEmpty extends Poly0 {
| implicit def cases[A](implicit F: Field[A]): Case0[A] = at[A](F.empty)
| }
scala> import shapeless.ops.hlist.FillWith
scala> val fill = implicitly[FillWith[polyEmpty.type, Option[String] :: HNil]]
scala> fill.apply
res1: fill.Out = None :: HNil |
|
need minimization without shapeless for testing |
@joroKr21 Not sure if this helps, but I wrote a very minimal Generic type class that should be (nearly) a drop-in replacement. In this case we'd have to get rid of ZipWith and FillWith too, but I assume we can just have simpler, noop definition. |
Thanks! I forgot to mention it here, but I already added a test over at scala/scala#6573. All we need to trigger the bug is an |
@joroKr21 I want to assign you the ticket as a record of who fixed it, but you'll need to accept my invite to the contributors team first. |
Notice that scalac attempts to resolve an implicit for
MonoidK[Option[String]]
whereas it should be trying to resolveMonoidK[Option]
-The text was updated successfully, but these errors were encountered: