sbt/contraband

Support for rudimentary optics

Opened this issue · 0 comments

Madoc commented

If the plugin would be extended by an option to generate lenses, it could output additional generated code similar to this:

object MyType {
  // autogenerated code ...
  val X:Lens[MyType,Int] = Lens(_.x, _.withX)
}

This would greatly help the user of the plugin to write deeply nested property modifications in a comprehensive manner, by combining lenses. It should not matter much which of the popular Scala Optics libraries would be supported, as long as it's as least one.

Adding those lenses manually is tedious and subverts the idea of code generation.