Closed dgouyette closed 6 years ago
Excellent idea! With a macro it would be a very powerful feature.
We could use https://github.com/mrvisser/sealerate to get the list of values, or make something similar.
I've added a test exemple for sealerate : https://github.com/scala-hamsters/hamsters/blob/master/shared/src/test/scala/io/github/hamsters/EnumSpec.scala#L56-L65
For the next major it would be good to have a Set instead of a list for the instance list method (as sealerate returns a Set and as it does not make sense to have duplicates in this list).
For now, you need to explicitly and manually write the following method
What's happen when i add another value. If we generate this method with a macro (annotation vs def macros...), that could help.