We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a0e347 commit 0d9a1f9Copy full SHA for 0d9a1f9
src/Effect/Ref.purs
@@ -25,9 +25,9 @@ foreign import read :: forall s. Ref s -> Effect s
25
foreign import modify' :: forall s b. (s -> { state :: s, value :: b }) -> Ref s -> Effect b
26
27
-- | Update the value of a mutable reference by applying a function
28
--- | to the current value.
29
-modify :: forall s. (s -> s) -> Ref s -> Effect Unit
30
-modify f = modify' (\s -> { state: f s, value: unit })
+-- | to the current value. The updated value is returned.
+modify :: forall s. (s -> s) -> Ref s -> Effect s
+modify f = modify' \s -> let s' = f s in { state: s', value: s' }
31
32
-- | Update the value of a mutable reference to the specified value.
33
foreign import write :: forall s. s -> Ref s -> Effect Unit
0 commit comments