Skip to content
Snippets Groups Projects
Unverified Commit 41cd21ed authored by Simon Marlow's avatar Simon Marlow Committed by GitHub
Browse files

Merge pull request #58 from queezle42/master

Simplify writeTMVar
parents d4da9d83 a48ddb86
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