summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-03-29 15:00:56 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-08 08:07:10 -0400
commitadc52bc84e52038653694c7cf99d7c8a6eff730c (patch)
treef6531045a2eaa3f82209d49613205e5c4a5e7e5a
parent352a463b7f82b504273cb274b3e0737112647c33 (diff)
downloadhaskell-adc52bc84e52038653694c7cf99d7c8a6eff730c.tar.gz
Make updTcRef force the result
This can lead to a classic thunk build-up in a TcRef Fixes #19596
-rw-r--r--compiler/GHC/Tc/Utils/Monad.hs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs
index bddb585a51..fb613c8f8d 100644
--- a/compiler/GHC/Tc/Utils/Monad.hs
+++ b/compiler/GHC/Tc/Utils/Monad.hs
@@ -695,8 +695,7 @@ writeTcRef = writeMutVar
updTcRef :: TcRef a -> (a -> a) -> TcRnIf gbl lcl ()
-- Returns ()
-updTcRef ref fn = liftIO $ do { old <- readIORef ref
- ; writeIORef ref (fn old) }
+updTcRef ref fn = liftIO $ modifyIORef' ref fn
{-
************************************************************************