From 9dcba8408a57cb8079efef4885c5430c29c2c107 Mon Sep 17 00:00:00 2001 From: hashirama Date: Tue, 28 Jan 2025 04:59:54 +0000 Subject: [PATCH] clarify the & operator --- lenses.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lenses.hs b/lenses.hs index 6194cb4..d6c4ce2 100644 --- a/lenses.hs +++ b/lenses.hs @@ -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