Open Qthunder opened 6 years ago
If we discover that the only way to achieve this is to hardwire the behavior into the Magnolia macro, i.e. the derivation object, the best solution (I think) would be to provide two different macro implementation methods inside the Magnolia
object. One of these would exhibit the current behavior, while the other would give priority to Magnolia
-derived instances over other typeclass instances found by implicit search.
Essentially, the current implementation of the gen
method would take and additional Boolean
parameter concerning the prioritization, and two new implementations would be provided, one calling it with true
, the other with false
.
The two challenges would be to,
Boolean
value, andI think the recent change by @fommil to make the implicitness of the gen
method significant probably fixes this, so I'm closing.
Currently, when recursively looking for implicits, Magnolia accords any other implicit higher priority than the Magnolia derived implicit itself.
It would be useful to have this behaviour configurable at the point of the macro invocation.