-
Notifications
You must be signed in to change notification settings - Fork 70
Change reexports to specialize to type Array #173
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
Even though this is a breaking change, this has irritated me since forever and I would like this to be merged. I have never wanted to import generic foldable methods from a monomorphic library. It just makes no sense. It also means all these methods are necessarily and always worst case due to Foldable, so we rely on irritating hacks like findIndex followed by index. |
I remember when we added these as re-exports in the first place I wasn't super enthusiastic about it, as I felt like it might obscure the fact that these operations are generic, and yeah, lead to some weird import/usage seeming contradictions. I could understand a little bit if they were implemented more efficiently as per Nate's point, but I'm not a fan of monomorphizing them just for the sake of re-exporting. I'd rather remove the re-exports than do this, personally. |
I think that there are probably quite a few usages in the wild that are appropriately monomorphic. I agree with you, but continuing to export them breaks less code. |
Are the Foldable versions of things really that bad in terms of performance here? Certainly the methods which are members of the Foldable class - that's |
To clarify, is the next action on this PR just fixing the conflicting files? |
a9d4e97
to
3e2ddd2
Compare
I would prefer to replace the implementations of the functions I listed with versions which are implemented in terms of arrays specifically for performance - that is, elem, notElem, find, findMap, scanl, and scanr. |
I think that the monomorphic versions should be specialized to |
Do we still need this since #189 has been merged? For specialized short-circuiting |
I'd say let's specialize |
I opened #193. |
I think let’s close this for now then, since we’re going the route of providing optimised specialised versions rather than just specialising but keeping the same implementation. Thanks anyway for getting the ball rolling on this @jvliwanag! |
Wondering if the reexports should specialize to Array. That way, in my application code,
Array.intercalate
guarantees that I'm working with an Array.This also helps with potential performance improvements by custom implementations later on that are specialized to Array.