well-typed / optics

Optics as an abstract interface
374 stars 24 forks source link

Split {Functor,Foldable,Traversable}WithIndex to a separate package #309

Closed arybczak closed 3 years ago

arybczak commented 4 years ago

These can be made a standalone package easily.

Then:

Thoughts?

phadej commented 4 years ago

I'd like to have that package, especially if we get lens use it. Otherwise I think it would be useless.

If lens would also use map-with-index (because indexed-functors is something different, given indexed-profunctors), then there might be enough "pressure" to reverse the dependency so unordered-containers and vector would depend on it, not the other way around. This is justified as it is more likely (though highly unlikely) that FunctorWithIndex would be in base than that the HashMap would be there.

So, I think we have to convince Edward (about the performance) first before making the package. I also think that ifolded in lens don't need to be a member, but it's just a hunch.

adamgundry commented 4 years ago

I think this might be useful to packages other than lens, and if someone wants it then splitting it out makes sense, but I agree the motivation is much more compelling if lens itself can use it. (I wonder if any other lens libraries might benefit from it? My first thought was microlens but that doesn't seem to have indexed optics.)

ocharles commented 4 years ago

Is this perhaps a resurrection of Edward's https://hackage.haskell.org/package/keys-3.12.3 library?

arybczak commented 4 years ago

@ocharles Right, it looks like it would be a subset of it. Most of the dependencies of this package would have to be reversed though.

phadej commented 3 years ago

This is done now.