How to understand the comment in shapeless guide?

The method below aims to get the field value of a single-field case class but it compiled failed because implicit not found.

  import shapeless.Generic
  import shapeless._

  def main(args: Array[String]): Unit = {
    getWrapperValue(Wrapper(42))
  }


  def getWrapperValue[A, H](input: A)
                           (implicit
                            gen: Generic.Aux[A, H :: HNil]): H =
    gen.to(input).head

  case class Wrapper(value: Int)

How to understand the explanation with the underline in document ?
I am confused why the compiler can’t find a Repr and ensure its length at the same time?

1 Like

Just a limitation of implicit resolution. So called over-constrained implicits. This seems to be too much work for implicits in a single step. Compiler doesn’t like complex types like (A, B), H :: L, A[T] in a type refinement.

1 Like