Closed serras closed 2 months ago
Total Project Coverage | 60.66% |
---|
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
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 optics
package.
Furthermore, I've realized that it should not be a prism, but simply an optional.
Cool, I was wondering about that given there was no "constructing" going on.
(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.