-
Notifications
You must be signed in to change notification settings - Fork 24
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 is #410
Add is #410
Conversation
Also I'd rather do nothing, i.e. don't add this combinator. |
I provided the link to lens for informational purposes, not for justification! The justification was that it was sufficiently confusing to me that
|
I didn't mean that we shouldn't have And the confusion I was referring to was not with |
@adamgundry, @arybczak what you think about this? |
OK, thanks for clarifying. Avoiding export from top level make perfect sense to me. What would be the right way to acheve that? |
I'd like I recently wanted to use it (with a prism), but had to settle for |
I agree that we shouldn't export Perhaps we should have a module for "things that aren't exported because of name collisions" and then it could also contain Although given that |
Testing for a particular type constructor reads nicer as |
OK, how about this? I chose Regarding |
(I'm not sure why the doctest is failing. I can't reproduce locally due to #413). |
Because the file is missing
at the end. |
optics-core/src/Optics/AffineFold.hs
Outdated
@@ -147,6 +147,8 @@ infixl 3 `afailing` -- Same as (<|>) | |||
-- >>> isn't _Just Nothing | |||
-- True | |||
-- | |||
-- The negation of this operator is 'Optics.Core.Extra.is' from | |||
-- "Optics.Core.Extra". | |||
isn't :: Is k An_AffineFold => Optic' k is s a -> s -> Bool | |||
isn't k s = not (isJust (preview k s)) |
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.
This should be isNothing
. Can you please change that?
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.
OK
optics-core/src/Optics/Core/Extra.hs
Outdated
) | ||
where | ||
|
||
import Optics.Internal.Optic |
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.
Only Optics.Optic
is needed, no Internal stuff is used here.
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.
Done
optics-core/src/Optics/Core/Extra.hs
Outdated
-- False | ||
-- | ||
is :: Is k An_AffineFold => Optic' k is s a -> s -> Bool | ||
is k = not . isn't k |
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.
Can you inline the definition of isn't
here so that the compiler has less things to do?
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.
Done
5313974
to
9ed5482
Compare
Thanks, looks good to merge to me 👍 Unless @adamgundry @phadej would like the module to have a different name. |
Thanks for taking care of this @tomjaguarpaw! I'm somewhat torn on the module name question, because |
OK, I've changed the module name to |
Thanks :) I'll merge after the weekend unless anyone objects. |
(the opposite of isn't)
I found it rather strange that
isn't
exists butis
doesn't.lens
hasis
. Could we add it tooptics
?