clarify the & operator
This commit is contained in:
parent
673371b905
commit
9dcba8408a
1 changed files with 4 additions and 1 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
{-
|
||||
|
||||
here i show how to use lenses to handle states (didnt found any example on states in internet)
|
||||
|
|
@ -62,6 +61,10 @@ main = do
|
|||
stateRef <- newIORef initialState
|
||||
|
||||
-- Corrected lens chain with &
|
||||
{-
|
||||
& is just backwards function application;
|
||||
x f , in which f will be applied to the value x
|
||||
-}
|
||||
modifyIORef' stateRef $ \s ->
|
||||
s & ui . keyBindings . at "Ctrl+X" .~ Just "cut"
|
||||
& user . prefs . darkMode .~ True
|
||||
|
|
|
|||
Loading…
Reference in a new issue