-
Notifications
You must be signed in to change notification settings - Fork 269
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
Split {Functor,Foldable,Traversable}WithIndex to a separate package #941
Comments
I'm unclear on what the relationship between the existing |
I'd be very happy to make
I guess @ekmett my disagree (but I'd leave the proof obligation on him, or whoever objects) to show they are strictly required, and optimizer cannot be made to do the right thing otherwise. TL;DR The benefit of FD, is e.g. |
I see.
Yes, this is definitely an awkward sticking point. I suspect that if you tried factoring out everything that |
FWIW |
I don’t know what you mean by there being no proof that the conjoined machinery is necessary. When we finally gave in and added it, it made quite an observable performance difference over the naive encoding. If you think about it for non-trivial indexes the difference is between doing that work at all or being able to completely skip it.
Bikeshedding to remove them seems to need to meet a pretty high proof bar to me; to me the proof burden is the other way around at this point, as without it you are now relying on worker-wrapper, a metric boatload of inlining and optimizations that at last check GHC was incapable of doing to remove significant costs or forcing users to make duplicate names for the indexed and non-indexed versions, which is actively against the design philosophy of lens.
…-Edward
On Sep 28, 2020, at 6:44 AM, Oleg Grenrus ***@***.***> wrote:
keys description:
In practice this package is largely subsumed by the lens package, but it is maintained for now as it has much simpler dependencies.
keys is TypeFamilies and *WithIndex classes are FunctionalDependencies based.
keys has ZipWithKey class, but I use https://hackage.haskell.org/package/semialign-indexed-1.1/docs/Data-Semialign-Indexed.html nowadays (and there is a sibling packages defining classes on top of optics versions).
I'd be very happy to make semialign-indexed depend on something shared by lens and optics.
keys also has FoldableWithKey1 and TraversableWithKey1, but there are no analogous classes in lens or optics, so I'd say they could just be dropped. Foldable1 doesn't seem to take off.
lens variants have lens specific (conjoined) method. As there is no "proof" whether that is strictly needed and it does ties to make optimized do something which it might just decide to not do, I don't think they are important.
I guess @ekmett my disagree (but I'd leave the proof obligation on him, or whoever objects) to show they are strictly required, and optimizer cannot be made to do the right thing otherwise.
TL;DR keys vs new-package is type families or functional dependencies question.
The benefit of FD, is e.g. Each in optics. It is cleaner to add i with FDs, then have a type-family EachIndex or EachKey.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Ah, but we're not saying that (indeed, It's about having |
I don’t have a strong objection to that part, at least off the cuff. I don’t recall a performance motivation for folding then into the class, mostly convenience about which gets defined, though I could be wrong. It has been several years.
I presume moving them to top level definitions or definitions per package that needs a different presentation would make it easier for, say, optics to roll its own flavor of them then?
I have a mild dislike for the fact that you are going to have a hard time convincing folks to flip their dependencies in my experience, and so it’d force lens into the -extras orphan instance pattern that I rather assiduously avoid.
I’m happy to consider grossly deprecating all of keys except for this part of the API and translocating these classes these wholesale with the tweak. I’d also consider a fresh package as a destination rather than deal with causing existing users of the long deprecated-in-my-mind keys package undue pain.
The major source of disquiet for me again is that getting stuck with a package full of orphans really sticks in my craw.
… On Oct 4, 2020, at 8:24 PM, Andrzej Rybczak ***@***.***> wrote:
I don’t know what you mean by there being no proof that the conjoined machinery is necessary
Ah, but we're not saying that (indeed, conjoined is quite nice).
It's about having itraversed/ifolded/imapped as standalone functions instead of class members.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This issue is a motivation to having just single
I'm in favor of new package, say
I don't think anything else have to be flipped, people who define In other words, I don't see a need for a "package full of orphans". |
Mirror for well-typed/optics#309
optics
also defines these classes and it would be good to not duplicate them.Also, if it was a standalone package, people could use it without depending on either
lens
oroptics
.The text was updated successfully, but these errors were encountered: