-
Notifications
You must be signed in to change notification settings - Fork 19
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 ==
definition of ComposedOptic
and IndexLens
from Setfield
#146
Conversation
Looks like |
Also makes sense to add these equality methods to other optics defined in the file: eg DynamicIndexLens and Recursive. |
Co-authored-by: Jan Weidner <[email protected]>
Co-authored-by: Jan Weidner <[email protected]>
# equality with non-equal range types (Setfield #165) | ||
for (l1, l2) ∈ [ | ||
@optic(_[1:10]) => @optic(_[Base.OneTo(10)]), | ||
@optic(_.a[1:10]) => @optic(_.a[Base.OneTo(10)]), | ||
@optic(_.a.b[1:10]) => @optic(_.a.b[Base.OneTo(10)]), | ||
@optic(_.a[Base.StepRange(1, 1, 5)].b[1:10]) => @optic(_.a[1:5].b[Base.OneTo(10)]), | ||
@optic(_.a.b[1:3]) => @optic(_.a.b[[1, 2, 3]]), | ||
] | ||
@test l1 == l2 | ||
@test hash(l1) == hash(l2) | ||
end |
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.
==
for ComposedFunction
s are ===
by https://github.com/JuliaLang/julia/blob/63e365feb8692b9d7cb5298954c26ab7af268171/base/Base.jl#L208, which means other than the first tuple (tests between IndexLens
), all will be false because they are not egal.
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.
Maybe create a question/issue for Julia itself?
Also I just realize adding equality for |
Fix #144
Pretty much copy and paste