有人可以解释这种行为并提供解决方法吗?Scala 2.12.7, kind-projector 0.9.8, scalacOptions += "-Ypartial-unification"
package tictactoe
import shapeless.{::, HList, HNil}
import tictactoe.ListOps.HasF
sealed trait LowPrio {
implicit def ifTail[F[_], H, X <: HList](implicit ev: HasF[F, X]): HasF[F, H :: X] = null
}
object ListOps extends LowPrio {
//Checks that property F[A] holds for at least one element of X
sealed trait HasF[F[_], X <: HList]
implicit def ifhead[F[_], H, X <: HList](implicit ev: F[H]): HasF[F, H :: X] = null
}
object Runner {
type IsString[A] = =:=[A, String]
//Works
implicitly[HasF[IsString, String :: Int :: HNil]]
/*
Doesn't work
could not find implicit value for parameter e: tictactoe.ListOps.HasF[[A]A =:= String,String :: Int :: shapeless.HNil]
implicitly[HasF[Lambda[A => =:=[A, String]], String :: Int :: HNil]]
*/
implicitly[HasF[Lambda[A => =:=[A, String]], String :: Int :: HNil]]
/*
Doesn't work
could not find implicit value for parameter e: tictactoe.ListOps.HasF[[α$0$]α$0$ =:= String,String :: Int :: shapeless.HNil]
implicitly[HasF[=:=[?, String], String :: Int :: HNil]]
*/
implicitly[HasF[=:=[?, String], String :: Int :: HNil]]
}