diff --git a/Control/Concurrent/STM/TMVar.hs b/Control/Concurrent/STM/TMVar.hs index d6ba0ef3eca276ae6a62364ae97735bc5e0a637a..69dacab09b7e26129ef52e8df2ad3d828b1d6a28 100644 --- a/Control/Concurrent/STM/TMVar.hs +++ b/Control/Concurrent/STM/TMVar.hs @@ -151,8 +151,10 @@ swapTMVar (TMVar t) new = do -- | Non-blocking write of a new value to a 'TMVar' -- Puts if empty. Replaces if populated. +-- +-- @since 2.5.1 writeTMVar :: TMVar a -> a -> STM () -writeTMVar t new = tryTakeTMVar t >> putTMVar t new +writeTMVar (TMVar t) new = writeTVar t (Just new) -- |Check whether a given 'TMVar' is empty. isEmptyTMVar :: TMVar a -> STM Bool