-
Notifications
You must be signed in to change notification settings - Fork 8
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
add match-lens #142
add match-lens #142
Conversation
This is interesting. It seems that it would often be the case that separate target-extraction and view-replacement wouldn't be needed, i.e. the car lens could be defined with just |
Yes, and conceptually it should be that simple, but I thought that would be way two restrictive to be useful in much more than the simplest patterns. But that idea was part of my motivation for making this, because conceptually that's how it should be. |
a8e4370
to
2983278
Compare
One thing I'm afraid of with a shorthand form like |
I think I made that mistake while playing around with this code, so you're definitely right about that. What are some examples where pattern matching lenses are more useful than composing traditional lenses? It feels strange to have most of the library work on the principle of making atomic lenses that go one level down and composing them together, while match lenses operate in a very different fashion. |
Match lenses can still just go one level down and can be composed with other lenses, even if they also allow going deeper. However, I think they can be a very clear and concise way of going "one level down" as well. |
That's true. I get the feeling they'll be more for one-off cases, but they're still useful to have. |
No description provided.