Skip to content

Commit

Permalink
withMVar and withMVarMasked don't require strictness
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisdral committed Mar 27, 2023
1 parent 2b8d04b commit 1634507
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions strict-mvar/src/Control/Concurrent/Class/MonadMVar/Strict.hs
Expand Up @@ -90,18 +90,10 @@ isEmptyMVar :: MonadMVar m => StrictMVar m a -> m Bool
isEmptyMVar v = Lazy.isEmptyMVar (mvar v)

withMVar :: MonadMVar m => StrictMVar m a -> (a -> m b) -> m b
withMVar v io = Lazy.withMVar (mvar v) io'
where
io' a = do
!b <- io a
pure b
withMVar v = Lazy.withMVar (mvar v)

withMVarMasked :: MonadMVar m => StrictMVar m a -> (a -> m b) -> m b
withMVarMasked v io = Lazy.withMVarMasked (mvar v) io'
where
io' a = do
!b <- io a
pure b
withMVarMasked v = Lazy.withMVarMasked (mvar v)

modifyMVar_ :: MonadMVar m => StrictMVar m a -> (a -> m a) -> m ()
modifyMVar_ v io = Lazy.modifyMVar_ (mvar v) io'
Expand Down

0 comments on commit 1634507

Please sign in to comment.