-
Notifications
You must be signed in to change notification settings - Fork 5
Add initial lens faq. #313
base: master
Are you sure you want to change the base?
Conversation
not sure about the title of the older question; if somebody has a better idea... @np: answer and context to first question missing. thanks! (-: |
Here are a few hints at using lenses based on examples.
First there is no need to wrap the AUpdate stack ourself, this works: Then instead of
The first remark still applies, secondly this kind of update which also returns the computed result is called a «pass-through» update in lens. The symbol for that in lens is
Some more hints:
|
also we should make a list of good resources:
|
questions from #342:
|
The
The doc for
Let's abstract |
[copied from https://github.com//pull/360#discussion_r59679339] instead of maybe "" id pw you can write: pw ^. _Just This works because when ^. is applied to a Prism it goes down to a Fold and get this type: (^.) :: Monoid a => s -> Fold s a -> a. In our case (^.) :: Maybe ST -> Fold (Maybe ST) ST -> ST which means that the monoid instance for ST is doing the work of defaulting to the empty string. |
[irc]
|
[irc]
|
[irc]
|
No description provided.