Recommended replacement for @Lenses
Am I right to assume that using Focus at all use sites instead of lenses pre-generated with the @Lenses annotation is gonna affect compilation times in the same way e.g. using circe.auto instead of circe.semiauto does? If so, what's the recommended approach here?
Should I replace @Lenses with something like val lens = GenLens[MyClass] in the MyClass companion object?
Is there a plan to support the derives clause in Monocle?
Rather than compile-times (it's fairly fast), you'll get code blow up since it generates an in-line method each call-site; YMMV as to whether you care or not.
You can use the Focus object or GenLens to share the optic. Your snippet is probably what I would do.
I don't understand what derives support would entail. Could you please elaborate?
Presumably, you would be able to write
case class MyClass (
fieldOne: String,
fieldTwo: Int
) derives Lenses
and then either do MyClass.fieldOne or MyClass.lens.fieldOne to access the lens for a particular field
@Lermex I don't think it works that way. IIUC derives Lenses would result in val lenses = Lenses.derived[MyClass] to be added to object MyClass. I don't think it has the capability to add multiple named fields to object MyClass unfortunately. (Would be awesome though!)
FYI, https://github.com/lampepfl/dotty/pull/16454