Skip to content

Add support for Scala 3 enum derivation #2233

@nb-ceffa

Description

@nb-ceffa

Would it be possible to support derivation of Scala 3 enums, please?

I would love to use something like this:

enum MyTestEnum derives Read {
  case MyFirstCase extends MyTestEnum
  case MySecondCase extends MyTestEnum
}

Version 1.0.0-RC7 returns the following error:

-- [E172] Type Error: ----------------------------------------------------------
1 |enum MyTestEnum derives Read {
  |                        ^
  |Cannot derive Read instance. Please check that each field in the case class has a Read instance or can derive one.
  |I found:
  |
  |    doobie.implicits.derived[MyTestEnum, A](
  |      /* missing */summon[scala.deriving.Mirror.ProductOf[MyTestEnum]], ???, ???,
  |      ???)
  |
  |But Failed to synthesize an instance of type scala.deriving.Mirror.ProductOf[MyTestEnum]: class MyTestEnum is not a generic product because it is not a case class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions