I have following a project that contains following code:
package ch.khinkali
import shapeless.{::, HList, HNil}
trait Second[L <: HList] {
type Out
def apply(value: L): Out
}
object Second {
type Aux[L <: HList, O] = Second[L] {type Out = O}
def apply[L <: HList](implicit inst: Second[L]): Aux[L, inst.Out] =
inst
}
object Main {
implicit def hlistSecond[A, B, Rest <: HList]: Second.Aux[A :: B :: Rest, B] =
new Second[A :: B :: Rest] {
type Out = B
def apply(value: A :: B :: Rest): B =
value.tail.head
}
def main(args: Array[String]): Unit = {
val second1 = Second[String :: Boolean :: Int :: HNil]
println(second1)
}
}
When I try on the Shell
following:
val second1 = Second[String :: Boolean :: Int :: HNil]
it shows the error message:
error: not found: value Second
I do import the package, as you can see the picture below:
What am I doing wrong?
Try wildcard imports:
import ch.khinkali._
import shapeless._
import ch.khinkali.Main._