Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LabelledGeneric instances for Sealed Classes #5

Closed
xuwei-k opened this issue Sep 30, 2020 · 0 comments
Closed

LabelledGeneric instances for Sealed Classes #5

xuwei-k opened this issue Sep 30, 2020 · 0 comments

Comments

@xuwei-k
Copy link
Owner

xuwei-k commented Sep 30, 2020

shapeless default implementation can derive scala sealed trait/class

scala> sealed trait XX; case class YY(i: Int) extends XX; case class ZZ(s: String) extends XX
trait XX
class YY
class ZZ

scala> LabelledGeneric[XX]
val res1: shapeless.LabelledGeneric[XX]{type Repr = YY with shapeless.labelled.KeyTag[Symbol with shapeless.tag.Tagged[String("YY")],YY] :+: ZZ with shapeless.labelled.KeyTag[Symbol with shapeless.tag.Tagged[String("ZZ")],ZZ] :+: shapeless.CNil} = shapeless.LabelledGeneric$$anon$2@4b5e8f34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant