Skip to content

implicit resolution of F[A] for introduced F[_] and A #10753

Closed
@fommil

Description

@fommil

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions