purescript-deprecated / purescript-lens

PureScript implementation of lens
78 stars 15 forks source link

Deprecate in favor of profunctor? #31

Closed joneshf closed 7 years ago

joneshf commented 8 years ago

Profunctor lenses seem to be the more elegant solution. And I don't much care to maintain a library that very few people will use. Does it make sense to keep this library around anymore?

The thing I love about van Laarhoven optics is that anyone can write them without any explicit dependencies since Functor is all you need. But look at profunctor lenses. They're so elegant and feel much simpler!

My concern with deprecating this library is what it changes for the end user. Does someone need to add an explicit dependency for purescript-profunctor in order to define their optics? Is that unreasonable? Wouldn't this concern go away if Strong/Choice shipped with prelude (or however Functor gets distributed)? Is there another aspect I'm missing here?

joneshf commented 8 years ago

cc @paf31 @garyb @purescript-contrib/lens

paf31 commented 8 years ago

@joneshf I think this library is still valuable, for the reasons you state. I also like the fact that van Laarhoven optics give free lifting operations for any type constructor you might have which happens to look like a -> f b, just like the related property for profunctor lenses.

I personally don't consider purescript-profunctors to be a very heavy dependency, so I don't mind pulling it in. I don't think it's necessary to bundle its classes in Prelude.

It might be a good thing to try to consolidate the two efforts though. It's not clear to me which is the better option there though, since once we get ~ constraints, we should be able to define indexed optics in purescript-lens. So we'd be trading indexed optics and fewer dependencies for the few minor benefits of profunctors lenses. It's not clear to me if that's a win or not. I also slightly prefer the profunctor-lenses API though 😄

rvion commented 8 years ago

Just had to choose a lens library, and got on this issue.

Beeing new to purescript, the current state of things made me think at first that purescript-lens was the recomended one (if not the only one), and not just one contender amongst two.

Indeed, purescript-lens seems like a generic name for a lens library, while purescript-profunctor-lensessounds like a library that define some lenses-related stuff "for profunctors"

Also When I look at readmes:

  1. https://github.com/purescript-contrib/purescript-lens#readme
  2. https://github.com/purescript-contrib/purescript-profunctor-lenses#readme

I see that:


@joneshf @paf31

is purescript-profunctors-lens really the recommended one going onwards ? is there a short explanation of benefits profunctors have versus laarhoven ? (runtime speedup ? type simplification ? type-checking speedup ? more powerfull ? something else ?)

  1. how about renaming those packages so the profunctor version is visible. eg:
    • purescript-lens -> purescript-lens-laarhoven
    • purescript-profunctor-lenses -> purescript-lens
  2. how about choosing a lens suffix (either lens or lenses) and use the same for both libraries
  3. how about writing a readme for the purescript-profunctor-lenses, similar to the purescript-lens, including a small link to some profunctor-lenses related discussions
  4. how about cross references in both projects to quickly jump from one to the other to understand the current state.
garyb commented 8 years ago

(1) isn't really possible, as it will break all bower dependencies for older projects referring to purescript-lens

Better documentation is definitely not going to hurt though!

joneshf commented 8 years ago

@rvion If you're looking for a lens library, either one is viable. The APIs are similar enough that if you learn one, you should be able to pick up the other if you change your mind. So, don't let the fact that there are two libraries stymie your progress.

If you're planning to use either library, you'll probably not find many differences between them. If you were planning to develop for either library, then it's more important to be more concerned about the differences between them.

This isn't meant to stop you from asking questions though.

ekmett commented 8 years ago

@garyb To be fair though all that has to happen is the role change happens at the same time as a major purescript compiler release, when everything breaks for everyone anyways. What is one more fire to put out? ;)