From 105b589633acb9cbbf1bdc2651858e196f59cab6 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Tue, 15 Oct 2024 16:07:21 +0200 Subject: [PATCH] Add `labelMVar` to the strict MVar library --- io-classes/CHANGELOG.md | 1 + .../src/Control/Concurrent/Class/MonadMVar/Strict.hs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/io-classes/CHANGELOG.md b/io-classes/CHANGELOG.md index 8016cc98..674c433c 100644 --- a/io-classes/CHANGELOG.md +++ b/io-classes/CHANGELOG.md @@ -6,6 +6,7 @@ * Added `threadLabel` to `MonadThread` * Added `MonadLabelledMVar` class. +* Added `labelMVar` to `Control.Concurrent.Class.MonadMVar.Strict` ### 1.7.0.0 diff --git a/io-classes/strict-mvar/src/Control/Concurrent/Class/MonadMVar/Strict.hs b/io-classes/strict-mvar/src/Control/Concurrent/Class/MonadMVar/Strict.hs index 4e296888..8b7407ca 100644 --- a/io-classes/strict-mvar/src/Control/Concurrent/Class/MonadMVar/Strict.hs +++ b/io-classes/strict-mvar/src/Control/Concurrent/Class/MonadMVar/Strict.hs @@ -26,6 +26,7 @@ module Control.Concurrent.Class.MonadMVar.Strict , modifyMVarMasked_ , modifyMVarMasked , tryReadMVar + , labelMVar -- * Re-exports , MonadMVar ) where @@ -62,6 +63,9 @@ toLazyMVar = mvar fromLazyMVar :: Lazy.MVar m a -> StrictMVar m a fromLazyMVar = StrictMVar +labelMVar :: MonadLabelledMVar m => StrictMVar m a -> String -> m () +labelMVar (StrictMVar m) = Lazy.labelMVar m + newEmptyMVar :: MonadMVar m => m (StrictMVar m a) newEmptyMVar = fromLazyMVar <$> Lazy.newEmptyMVar