This is a mistake in the formless < Lazy - milessabin / unteless # 309
I have a PR that forces your example to compile - milessabin / shapeless # 797 (I checked with publishLocal )
The main problem with Lazy is that it extends type aliases too much ( A @@ B is a type alias for A with Tagged[B] ), which in turn causes a Scala error - scala / error # 10506
Scala error does not have a clear solution. This is another embodiment of the problem of subtyping and parametric polymorphism, which complicates the conclusion of the type. Its essence is that Scala must perform a subtype check and output at the same time. But when we put some type variables, such as A and B into a sophisticated type, like A with Tagged[B] (in fact, circe finishes searching for FieldType[K, A with Tagged[B]] , where FieldType is another type alias that hides specified type), subtyping should be checked for each component separately. This means that the order in which we select component testing determines how variables of type A and B will be constrained. In some cases, they are too or too limited and cannot be displayed correctly.
Apropo, formless tests show a workaround , but I donβt think it applies to circe, because it uses some kind of macro, and how to do a vanilla type derivation.
In short, you can:
- Wait for the formless (please upvote # 797 ) and the subsequent release of circe
- Do not use tagged tags = /
- Try using a different encoding without refined or structured types - maybe alexknvl / newtypes ? (I have not tried)
g.krastev
source share