-
Notifications
You must be signed in to change notification settings - Fork 703
Lens -> State integration returning the old value #324
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
Conversation
- provides `LensFamily.modo` which returns the old value (as an alternative to `LensFamily.mods` which returns the new value) - provides `LensFamily.assigno` which returns the old value (as an alternative to `LensFamily.assign` which returns the new value) - both `modo` and `assigno` are provisional names - both `modo` and `assigno` do not have a symbolic equivalent yet
|
BTW motivation for this patch is to reduce the following example: val emptySv1: State[Game,Cards] = for {
stack ← State.gets[Game,Cards](_.stack)
_ ← stackL := Cards()
} yield stack... to this much shorter one: val emptySv2: State[Game,Cards] = stackL.assigno(Cards()) |
|
AFAIK from looking at the |
|
@tonymorris @pthariensflame Could you have a look at that please? |
|
I'm fine with |
|
Also, I'd rather tighten up the implementations as: |
|
Thanks for the comments, @pthariensflame. The commits above apply the suggested changes. |
|
You seem to have left the type parameter on |
|
Merged as 620787c. Thanks! |
LensFamily.modowhich returns the old value (as an alternative toLensFamily.modswhich returns the new value)LensFamily.assignowhich returns the old value (as an alternative toLensFamily.assignwhich returns the new value)modoandassignoare provisional namesmodoandassignodo not have a symbolic alias yetI'd welcome suggestions for the final names of these new variants as well as suggestions for the symbolic aliases.