-
Notifications
You must be signed in to change notification settings - Fork 449
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
Delicate optics #3454
Delicate optics #3454
Conversation
Kover Report
|
Can we have a test showcasing what happens when the optics are used incorrectly? Not super knowledgable about the theory, so I'd like to have examples of incorrect usage and to codify the current behaviour so that it doesn't change unexpectedly |
I've added the information to the documentation. Furthermore, I've realized that it should not be a prism, but simply an optional. The example was taken from Haskell's |
Cool, I was wondering about that given there was no "constructing" going on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice @serras!! 👏 👏
(Raised by this Slack conversation)
This PR brings a couple of unlawful optics, namely filtering values and aggregating. These are potentially dangerous in different ways, so they need to be opted-in using
DelicateOptic
.@nomisRev I've also renamed the
filter
functions in thedsl
package tofilterIndex
, as that's the place they make the filtering. That way the new one can get thefilter
name, which coincides which what you expect from a collection / traversal. AFAIK thatfilter
in the DSL hadn't been released yet, so should be OK changing it.