-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
fmap API that accepts an arbitrary walk does not use function f #62
Comments
I don't remember the exact decision behind this, but @darsnack might. |
That's looks like leftover from before |
To me, renaming the function to I'd be interested to hear what other's thoughts are though, because if we make a breaking change let's make sure we're at least doing it right:) also unaware whether or not people have actually been using this API in practice |
In my mind and APIs in other programming languages, |
Since all the walks are callable structs I think it's fair to call it a verb? (Except with the dispatch hidden as the 0th arg, so hm maybe that's a noun :) So I guess the first question is if we want to keep the |
Can I ask how #32 fits into all this? |
Taking in a |
I agree, I just thought that there might be other ways of doing the same thing that don't require #61, by replacing But I think the current approach is also fine and pretty readable, and more flexible in case that flexibility is somehow needed in the future -- just mentioned it due to @ToucheSir 's comment that walks should enforce self-recursion. (Although actually, do we think this flexibility of allowing something other than recursion is unnecessary?) What do we think of the general approach of keeping |
Sigh, nerd-sniped myself into doing a prototype of the idea for getting rid of the |
Okay, empirical evidence suggests that there does not exists a non-breaking solution beyond keeping the current fancy |
Yeah storing the outer walk in a field is something I considered in #43, but I decided against it. It can result in silent errors if the walk isn't constructed properly. Part of the usability of |
It was really close to non-breaking to simply set |
Absolutely. The core idea is that, much like one can express Implementation-wise, #32 is out of date because it predates all the walk changes that came with Functors 0.4. However, post 0.4 |
The way I understand the library, it seems like so long as all these primitives (fold, reduce, traverse, etc.) all ultimately rely on running a recursive walk, they would all still need a low-level primitive that is agnostic to what sort of transform it is doing, like |
In other words,.something like |
Well, fundamentally |
Looking at #32, right, I can see that. [This was mostly in reply to your original comment. About your edit that it might be more general than a generalized fold: I actually don't clearly see why since your |
So do we have a plan for closing this? #65? |
In the signature
fmap(walk::AbstractWalk, f, x, ys...)
in the public API, the functionf
is ultimately not used. Arguably, since this API does not usef
, it should be deprecated and replaced by something that is not calledfmap
(which should be reserved for the special case of anExcludeWalk
wheref
is applied).However, these changes should be made with caution due to potentially breaking effects. See the body of PR of #61 for some additional info.
Edit: it's possible #32 helps with a lot of this
The text was updated successfully, but these errors were encountered: