I am trying to create a hlist implicitly.
case class A(value: Int)
implicit def lift(single: A): A :: HNil = single :: HNil
def something[L <: HList](l: L)(implicit lUBConstraint: LUBConstraint[L, A],
isHCons: IsHCons[L]) = {
println("works")
}
something(A(1) :: A(2) :: HNil) //works
something(A(1)) //not works
something(lift(A(1))) //works
something(A(1)) is not working. However, I use intellij idea and It can detect that lift is proper to use here.
Here is the error message from compiler.
inferred type arguments [Boot.A] do not conform to method something's type parameter bounds [L <: shapeless.HList] [error] something(A(1)) //not works [error] ^ [error]
type mismatch; [error] found : Boot.A [error] required: L [error] something(A(1))
could not find implicit value for parameter lUBConstraint: shapeless.LUBConstraint[L, Boot.A] [error] something(A(1)