Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lens macro-generated for a specific field should allow introspecting the name #1363

Open
nafg opened this issue Jun 9, 2023 · 2 comments
Open
Labels

Comments

@nafg
Copy link

nafg commented Jun 9, 2023

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.

@yilinwei
Copy link
Collaborator

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?

@nafg
Copy link
Author

nafg commented Jun 28, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants