Skip to content

Instantly share code, notes, and snippets.

@tobnee
Created July 9, 2014 15:14
Show Gist options
  • Save tobnee/3bdafd43a449da5e02ec to your computer and use it in GitHub Desktop.
Save tobnee/3bdafd43a449da5e02ec to your computer and use it in GitHub Desktop.
poly functions / map over HLists in shapeless
def publish = {
val a AEvent("a")
val b = BEvent("b")
a :: b :: a :: HNil
}
def use = {
object handler extends Poly1 {
implicit def caseA = at[AEvent](_.toString)
implicit def caseB = at[BEvent](_.toString)
}
publish.map(handler)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment