Skip to content

Instantly share code, notes, and snippets.

@mrdziuban
Created November 27, 2023 14:38
Show Gist options
  • Save mrdziuban/02b94ce717eb8a9a9cce599a442d44a4 to your computer and use it in GitHub Desktop.
Save mrdziuban/02b94ce717eb8a9a9cce599a442d44a4 to your computer and use it in GitHub Desktop.
semiauto-sealed-trait-option4.scala
sealed trait Test1
object Test1 {
case object Member extends Test1
}
sealed trait Test2
object Test2 {
sealed trait SubTrait extends Test2
case object Member extends SubTrait
}
sealed trait Test3
object Test3 {
case class Member() extends Test3
}
// these all succeed and automatically derive `Decoder`s for their subtypes
io.circe.Decoder.derived[Test1]
io.circe.Decoder.derived[Test2]
io.circe.Decoder.derived[Test3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment