optics-dev / Monocle

Optics library for Scala
https://www.optics.dev/Monocle/
MIT License
1.64k stars 205 forks source link

Is it possible to make @Lenses ignore some fields? #1411

Open GalLalouche opened 7 months ago

GalLalouche commented 7 months ago

Suppose I have the following case class (I'm using Scala 2.13):

case class Foo(
  a: Int,
  b: Int,
  ...,
  z: Int,
  noLens: Int
)

Is there any way to use @Lenses to create lenses for all fields except noLens? I tried using private val or multiple parameter lists, but both cases resulted in a compilation error. I know I can manually create all the other lenses, but that's very verbose.

Thanks

julien-truffaut commented 7 months ago

Sorry, it is not supported.