Local copy:
/***
scalaVersion := "2.11.8"
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.7.1")
libraryDependencies ++= {
val shapelessVersion = "2.2.5"
Seq(
"com.chuusai" %% "shapeless" % shapelessVersion
)
}
*/
import shapeless._
case class Foo()
trait Wrapper
case class S(s: String) extends Wrapper
case class I(i: Int) extends Wrapper
object Main extends App {
object wrap extends Poly1 {
implicit def caseString = at[String](S.apply)
implicit def caseInt = at[Int](I.apply)
implicit def caseOther[T] = at[T](identity)
}
type A = Foo :: String :: HNil
type B = Foo :: Int :: HNil
type Out = Foo :: Wrapper :: HNil
val a: A = Foo() :: "foo" :: HNil
val b: B = Foo() :: 42 :: HNil
val aw: Out = a.map(wrap)
val bw: Out = b.map(wrap)
}
Errors:
[error] /tmp/renderercqsCBmArxo/src/main/scala/test.scala:56: could not find implicit value for parameter mapper: shapeless.ops.hlist.Mapper[Main.wrap.type,Main.A]
[error] val aw: Out = a.map(wrap)
[error] ^
[error] /tmp/renderercqsCBmArxo/src/main/scala/test.scala:57: could not find implicit value for parameter mapper: shapeless.ops.hlist.Mapper[Main.wrap.type,Main.B]
[error] val bw: Out = b.map(wrap)
[error] ^
[error] two errors found
[error] (compile:compileIncremental) Compilation failed
How would I change that single last element into another one?