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

Single-line import of core, lenses, and combinator #26

Open
zachallaun opened this issue Feb 15, 2023 · 3 comments
Open

Single-line import of core, lenses, and combinator #26

zachallaun opened this issue Feb 15, 2023 · 3 comments
Labels
feature request Request for addition feature

Comments

@zachallaun
Copy link

Pathex is super neat, but the ergonomics are hampered by having to import 2-3 different modules for even relatively simple uses. This example on the forum, for instance: https://elixirforum.com/t/find-a-specific-string-in-an-unstructured-and-nested-list/53918/10?u=zachallaun

I’d propose that use Pathex should be updated to import a much larger set of primitives, including those from combinator, lenses, etc.

@zachallaun
Copy link
Author

Alternatively: Lenses and Combinator could become private modules, with their functions being re-exported by the Pathex module. This means the behavior of use Pathex would not need to change and documentation would be consolidated.

@zachallaun zachallaun changed the title Suggestion: use Pathex should import everything Single-line import of core, lenses, and combinator Feb 15, 2023
@zachallaun
Copy link
Author

Updated the title to something that better represents the desired outcome.

@hissssst
Copy link
Owner

Yeah, I've thought about this and I came up with different approaches for this

  1. Leave it all as it is. It is simple, explicit and it reflects how people use the library.
    For 90% use cases, you just import Pathex. For 9% of use cases you also import Pathex.Lenses. And only for 1% of use cases import Pathex.Combinator. And even in most cases, one could just call functions from Pathex.Lenses or Pathex.Combinator directly

  2. Move everything to Pathex and suggest using import Pathex.
    This would add a lot of complex functions with very generic names. Using only option would be even more verbose

  3. Move everything to use Pathex has the same problem as above

  4. use Pathex, lenses: true, combinator: true. Nice, but this saves only a few characters and is less explicit

@hissssst hissssst added the feature request Request for addition feature label Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for addition feature
Projects
None yet
Development

No branches or pull requests

2 participants