Skip to content

Invalid implicit resolution attempt for higher kind #10849

@carymrobbins

Description

@carymrobbins

Notice that scalac attempts to resolve an implicit for MonoidK[Option[String]] whereas it should be trying to resolve MonoidK[Option] -

Welcome to Scala 2.12.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_131).
Type in expressions for evaluation. Or try :help.

scala> import shapeless._, cats._, cats.implicits._

scala>   object polyEmpty extends Poly0 {
     |     implicit def cases[F[_], V](implicit F: MonoidK[F]): ProductCase.Aux[HNil, F[V]] =
     |       at[F[V]](F.empty)
     |   }
defined object polyEmpty

scala> HList.fillWith[Option[String] :: HNil](polyEmpty)
<console>:22: this.polyEmpty.cases is not a valid implicit value for shapeless.poly.Case0.Aux[polyEmpty.type,Option[String]] because:
hasMatchingSymbol reported error: could not find implicit value for parameter F: cats.MonoidK[Option[String]]
       HList.fillWith[Option[String] :: HNil](polyEmpty)
                                             ^
<console>:22: hlist.this.FillWith.hconsFill is not a valid implicit value for shapeless.ops.hlist.FillWith[polyEmpty.type,Option[String] :: shapeless.HNil] because:
hasMatchingSymbol reported error: could not find implicit value for parameter hc: shapeless.poly.Case0.Aux[polyEmpty.type,Option[String]]
       HList.fillWith[Option[String] :: HNil](polyEmpty)
                                             ^
<console>:22: error: could not find implicit value for parameter fillWith: shapeless.ops.hlist.FillWith[polyEmpty.type,Option[String] :: shapeless.HNil]
       HList.fillWith[Option[String] :: HNil](polyEmpty)
                                             ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions