Skip to content

Instantly share code, notes, and snippets.

@cab
Created January 21, 2016 20:42
Show Gist options
  • Save cab/44ab75567912332d05d7 to your computer and use it in GitHub Desktop.
Save cab/44ab75567912332d05d7 to your computer and use it in GitHub Desktop.
object tester extends Poly1 {
implicit def hlistCase[T <: HList](implicit mapper : Mapper[tester.type, T]) = at[T](x => {
testMap(x)
})
implicit def anyCase[T] = at[T](x => 1)
}
def testMap[T <: HList](t: T)(implicit mapper : Mapper[tester.type, T]) = t.map(tester)
val entities = (ComponentA() :: HNil) :: HNil
println(testMap(entities))
/*
error: could not find implicit value for parameter mapper: shapeless.ops.hlist.Mapper[tester.type,shapeless.::[shapeless.::[ComponentA,shapeless.HNil],shapeless.HNil]]
at: println(testMap(entities))
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment