-
-
Notifications
You must be signed in to change notification settings - Fork 16
add getkeypath
and haskeypath
#76
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
Conversation
8dbe275
to
4183248
Compare
ec8dcb9
to
e7b69d0
Compare
What's your thought on extensibility for arbitrary types? Do we care about that or is it not a problem because |
I'm not sure what you mean, The convenience of using indexing |
One example I thought of is types like |
ok now I understand. As you said maybe we don't have to care because in a recurrence one calls Or we can tie these new methods to _haskey(x, k::Symbol) = k in children(x)
function _getkey(x, k::Symbol)
assert _hasjey(x, k)
return getproperty(x, k)
end I'm not sure which one is better. |
Do you think we could make the keypath functions use |
I didn't know about the existence of |
efa17fc
to
3856252
Compare
ready to go |
Some convenience functions for KeyPath on top of #74 so that we can have
The possibly controversial part of this PR is that we define indexing with a KeyPath for
@functor
ized types.This would be no longer possible if we decide to functorize everything by default as proposed in #49, so maybe better leave the indexing part out?
TODO
fmapstructure
and addKeyPath
,fmap_with_path
,fmapstructure_with_path
#74 to be mergedadd a convenience macro constructor kp":a.1.'a'"?(not worth it at the moment)