Closed clayrat closed 9 years ago
Could you try with the elements of the enumeration declared as objects? ie.,
object BarA extends EnumVal { val name = "A" }
I'm surprised that it works for two elements.
Actually, could you open a feature request against shapeless to add Generic
support for things like,
sealed trait EnumVal
val BarA = new EnumVal { val name = "A" }
val BarB = new EnumVal { val name = "B" }
val BarC = new EnumVal { val name = "C" }
I can't make any promises, but if it's possible it looks like it would be useful.
It seems to work when you declare enum vals as objects.
Sorry, I don't think I have the rights to add labels to issues.
Trying to use argonaut-shapeless to derive case class Json encoders for some autogenerated by ScalaBuff code, I've ran into a following issue:
This code fails to compile with the following errors:
There are several ways to make it compile:
BarA
,BarB
,BarC
, leaving only two.Option
in the definition ofFoo.barEnum
, making it simplyBarEnum.EnumVal
implicit def BarEnumValEncodeJson: EncodeJson[BarEnum.EnumVal]
toimplicit def OptBarEnumValEncodeJson: EncodeJson[Option[BarEnum.EnumVal]]
Given that in real code everything outside of
main
is autogenerated, only the last option is a viable workaround.