Skip to content

Commit

Permalink
Fix strictness of stateTVar
Browse files Browse the repository at this point in the history
  • Loading branch information
konsumlamm committed Sep 6, 2023
1 parent f8582bd commit 6c58d7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Control/Concurrent/STM/TVar.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE CPP, MagicHash, UnboxedTuples #-}
{-# LANGUAGE BangPatterns, CPP, MagicHash, UnboxedTuples #-}

#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Trustworthy #-}
Expand Down Expand Up @@ -73,7 +73,7 @@ modifyTVar' var f = do
stateTVar :: TVar s -> (s -> (a, s)) -> STM a
stateTVar var f = do
s <- readTVar var
let (a, s') = f s -- since we destructure this, we are strict in f
let !(a, s') = f s
writeTVar var s'
return a
{-# INLINE stateTVar #-}
Expand Down

0 comments on commit 6c58d7f

Please sign in to comment.