scalalandio / chimney

Scala library for boilerplate-free, type-safe data transformations
https://chimney.readthedocs.io
Apache License 2.0
1.15k stars 91 forks source link

Support runtime-defined enums #537

Open MateuszKubuszok opened 3 months ago

MateuszKubuszok commented 3 months ago

Some enum-like types cannot be guaranteed to have fixed number of instances known at compile-time (or at least they cannot have exhaustive pattern-matching).

It would be useful to define some interface which could mapping to/from them in the runtime (probably only with PartialTransformers).

Example which could be handled with such approach could be various customizations to scala.Enumeration (they might not work the best with what we use for sealed/Scala 3 enums/Java enums) or large, immutable (but build in the runtime) sets of values.