Created
July 9, 2014 15:14
-
-
Save tobnee/3bdafd43a449da5e02ec to your computer and use it in GitHub Desktop.
poly functions / map over HLists in shapeless
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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