Skip to content
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

Export more of MicroLens: (.~), (%~), others? #123

Open
akhra opened this issue Jul 21, 2018 · 4 comments
Open

Export more of MicroLens: (.~), (%~), others? #123

akhra opened this issue Jul 21, 2018 · 4 comments

Comments

@akhra
Copy link
Collaborator

akhra commented Jul 21, 2018

Discussion. Considering that set and over are exported, I assume (.~) and (%~) were omitted to minimize operator soup in RIO, for newbie-friendliness and/or best practice assertion. But critiques aside, there are quite a few important libraries that provide a lens-based configuration API (e.g. http-client), and their examples tend to lean heavily on (.~). And if that's provided, it seems silly not to toss in (%~).

So:

  • Are there strong reasons why we don't want to open this door at all?
  • Do we want to provide these operators in the prelude?
  • Whether or not anything more goes in the prelude, is it worth adding RIO.Lens with a more complete set of re-exports? Which ones?
@snoyberg
Copy link
Collaborator

I'd lean towards a RIO.Lens module, and being very conservative about adding operators or functions the RIO.

@akhra
Copy link
Collaborator Author

akhra commented Jul 23, 2018

I've been leaning that way myself. So the remaining question is, what to re-export and from where? Initial thoughts:

  • RIO.Lens.Partial: singular, (^?!)
  • RIO.Lens.Unchecked: failing, _1.._5? (due to behavior on undefined)
  • RIO.Lens.Pseudo (or just omitted): the not-actually-Iso and Prism functions
  • RIO.Lens: Everything else
  • RIO.Lens.Operators: All operators except (^?!), as a convenience for getting them all unqualified

I'm not sure about .Operators (does RIO.Lens itself need to be qualified?) or the placement of _1.._5 (frankly I'm not 100% sold on their existence). Thoughts? Did I miss anything that belongs in .Partial or .Unchecked? Should we be more conservative in general, skipping or relocating things like (<>~) and the LensLike operators? I'm not fully fluent in lenses yet, much less the ins and outs of how the different lens libraries interact or conflict, so I don't entirely trust my own judgement on this.

@snoyberg
Copy link
Collaborator

I don't think I can weigh in that effectively here, I'm not that familiar with what is commonly used in lens-heavy projects. I still tend to stick to a relatively small subset of lens functionality in my code.

@akhra
Copy link
Collaborator Author

akhra commented Apr 24, 2019

I'm starting to lean in the same direction, to the point that I was lately annoyed to find no prefix synonym for (^.). Leaving this open for others to weigh in, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants