Skip to content

Commit 70b28fa

Browse files
committed
Use strict variant of atomicModifyIORef in System.Metric.Label.modify
1 parent 449c646 commit 70b28fa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

System/Metrics/Label.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module System.Metrics.Label
1212
, modify
1313
) where
1414

15-
import Data.IORef (IORef, atomicModifyIORef, atomicWriteIORef, newIORef, readIORef)
15+
import Data.IORef (IORef, atomicModifyIORef', atomicWriteIORef, newIORef, readIORef)
1616
import qualified Data.Text as T
1717
import Prelude hiding (read)
1818

@@ -34,6 +34,4 @@ set (C ref) !i = atomicWriteIORef ref i
3434
-- | Set the label to the result of applying the given function to the
3535
-- value.
3636
modify :: (T.Text -> T.Text) -> Label -> IO ()
37-
modify f (C ref) = do
38-
!_ <- atomicModifyIORef ref $ \ i -> let i' = f i in (i', i')
39-
return ()
37+
modify f (C ref) = atomicModifyIORef' ref $ \i -> (f i, ())

0 commit comments

Comments
 (0)