You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's cases where the typeclass we want to derive from a case class is a super-type of the typeclass. One such example is the JSON encoding typeclass in play-json which look likes the following:
In this example, OWrites is a Writes that guarantees that the JsValue is actually a JsObject. I would like to be able to derive the OWrites typeclass on case class using Magnolia. AFAIK, this is currently not possible since the parameters of the case class don't always have an implementation for OWrites, but sometime just an implementation for Writes.
Apriori (I'm likely missing something), making a small change to the interface would make that possible for scala 3
There's cases where the typeclass we want to derive from a case class is a super-type of the typeclass. One such example is the JSON encoding typeclass in play-json which look likes the following:
In this example,
OWrites
is aWrites
that guarantees that theJsValue
is actually aJsObject
. I would like to be able to derive theOWrites
typeclass on case class using Magnolia. AFAIK, this is currently not possible since the parameters of the case class don't always have an implementation forOWrites
, but sometime just an implementation forWrites
.Apriori (I'm likely missing something), making a small change to the interface would make that possible for scala 3
The change for scala 2 would be more involved.
The same concept could be applied to sealed trait derivation, but the use cases are less obvious.
The text was updated successfully, but these errors were encountered: