-
Notifications
You must be signed in to change notification settings - Fork 269
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
$ instead of %? #17
Comments
The mnemonic for % is 'mod'ify. ;) We actually explicitly rejected using $ back for this in data-lens, and now it is a compatibility point between this, lens-family and data-lens, so i'm somewhat loath to break expectation on it. |
One issue with $= is the intuition that it is applying a function here is slightly off. l +~ a uses lens_value + a |
Yeah, I noticed that too. If we had an operator for flip ( I was also expecting the compability argument. ;) If it's a change worth making, compability will only be more of a deterrent in the future than it is now. (Although there are ways to preserve it, like export-without-documenting or simply providing both.) If it's not worth changing then obviously that's that. |
Pretty much the same consistency argument came up whe we originally picked % for data lens over If I were to pursue it it'd probably be best done as ~$ to indicate the side being edited or something, but that explanation is even worse. I'm going to close out the issue, but I definitely appreciate the feedback. |
@glehel said "If we had an operator for Having |
For comparison purposes, here's (#) = flip ($) from diagrams http://hackage.haskell.org/packages/archive/diagrams-lib/0.4.0.1/doc/html/Diagrams-Util.html#v:-35- On Tue, Sep 11, 2012 at 1:10 AM, Oren Ben-Kiki notifications@github.comwrote:
|
Hrmm, one downside to |
Re compatibility, I'd rather break it now before I get too many users, but at least at the moment, I think the |
I wonder if a Maybe
With ( |
I would make the case that BTW, if it were called |
Alternately the same logic could be used in reverse to just rename ('|>') to ('%'), without renaming dozens of combinators. |
That is a good point. I personally don't mind using |
Annoyingly, the precedence issue is pretty brutal for defining something like .%. -- The only . like operator that has the correct precedence to allow it is >>>, which would lead to a %>> combinator, but visually it composes backwards from what you're looking for. |
Yes, I noticed that.. I couldn't find a way around it and gave up short of trying to reverse the associativity of |
Magic found |
So the key insight is that once one "drops out of lens" using Well done magic indeed! |
I think it would make sense to use $ instead of % where the mnemonic is for applying a function, given that ($) is the function application operator, e.g. ($ =) instead of (%=), ($
) instead of (%), and so on (Control.Lens.Setter, Type, IndexedLens, and IndexedSetter seem to be affected). Is there a rationale for % besides it being an otherwise unused symbol?If you agree I can prepare a patch.
(I'm guessing operators with more than one % like (%%=) and (%%
) should also become ($$=) and ($$ ) in that case, rather than keeping one of the %s?)The text was updated successfully, but these errors were encountered: