Monocle
Monocle copied to clipboard
Lens macro-generated for a specific field should allow introspecting the name
For instance, given
case class Person(age: Int)
val personAge = GenLens[Person](_.age)
It would be useful to be able to do personAge.name and get back "age". There are a number of use cases for this.
Hmm. I understand why you want this, and I think it would be a nifty feature, but I feel that we'd only be able to add it onto the final class generated by GenLens and not on the Lens trait overall. Would that still be useful?
Yes that's exactly what I had in mind, sorry for not being more clear. Of course it's not in the contract of lenses in general, but in the specific case of generating with the macro for a field, it would be useful as a bonus.