Closed
Description
I expected the following code to compile
trait Bar[F[_]]
trait Foo[A]
object Foo {
implicit def string: Foo[String] = ???
implicit def bar: Bar[Foo] = ???
}
case class Problem[A](a: A)
object Problem {
implicit def deriv[A, F[_]](implicit F: F[A], B: Bar[F]): F[Problem[A]] = ???
deriv[String, Foo] // works
implicitly[Foo[Problem[String]]]
}
but I get
could not find implicit value for parameter e: Foo[Problem[String]]
[error] implicitly[Foo[Problem[String]]]
[error] ^
This is minimised, if you remove the B: Bar[F]
constraint, it compiles (but then I don't have everything I need)
Is there a workaround?