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

Add prop variant using VTA #145

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

amesgen
Copy link

@amesgen amesgen commented Jul 19, 2023

Description of the change
Adds a variant of prop using VTA (visible type application) which was added in Purescript 0.15.10. Motivation is mainly to save some characters:

prop @"foo"                 :: forall a b r. Lens { foo :: a | r } { foo :: b | r } a b

vs

prop (Proxy :: Proxy "foo") :: forall a b r. Lens { foo :: a | r } { foo :: b | r } a b
prop (Proxy :: _ "foo")     :: forall a b r. Lens { foo :: a | r } { foo :: b | r } a b

I chose to also name it prop and put it in a new module (as it seems very unlikely that both variants are used in the same project), but also happy to change to other alternatives, like naming it prop' and putting it in Data.Lens.Record, or simply replacing the current prop with the VTA-enabled prop (would be a breaking change).


Checklist:

  • Added the change to the changelog's "Unreleased" section with a link to this PR and your username
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation in the README and/or documentation directory
  • Added a test for the contribution (if applicable)

@JordanMartinez
Copy link
Contributor

Adding VTAs to the ecosystem is something I was planning to do in the 0.16.0 ecosystem update. And before that happens, we need to specify some guidelines for how to do this, so that whatever design we come up with is consistent across the ecosystem rather than ad-hoc designs that differ across libraries.

If you're interested in contributing to this effort, please type up some initial guidelines on Discourse.

@bakhtiyarneyman
Copy link

bakhtiyarneyman commented Jan 23, 2024

prop is by far the most frequently referenced function in our codebase. This is an opportunity to pick a shorter name for the combinator. How about on?

@JordanMartinez
Copy link
Contributor

JordanMartinez commented Jan 23, 2024

Does your codebase entail a library or application. If the latter, there's nothing stopping you from defining your own prelude with its custom imports to suit your naming preferences.

@bakhtiyarneyman
Copy link

It's an application, and indeed we do have a P4 for exactly that!

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

Successfully merging this pull request may close these issues.

3 participants