Skip to content
Snippets Groups Projects
Commit a48ddb86 authored by Jens Nolte's avatar Jens Nolte
Browse files

Simplify writeTMVar

parent d4da9d83
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment