You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### Motivation
Labels make it easier to track the origin and lifecycle of threads,
queues, and transactional variables, especially when used in simulations
(e.g. `IOSim`) or debugging tools.
#### 🔄 Changes
This PR introduces **labelled variants** of common concurrency
primitives and combinators to improve observability and debugging.
Replaced existing constructors/combinators with labelled versions:
* **STM / TVars / Queues**
* `newTVar` → `newLabelledTVar`
* `newTVarIO` → `newLabelledTVarIO`
* `newEmptyTMVar` → `newLabelledEmptyTMVar`
* `newEmptyTMVarIO` → `newLabelledEmptyTMVarIO`
* `newTQueue` → `newLabelledTQueue`
* `newTQueueIO` → `newLabelledTQueueIO`
* `newTBQueue` → `newLabelledTBQueue`
* `newTBQueueIO` → `newLabelledTBQueueIO`
* **Async / Thread combinators**
(based on `Control.Monad.Class.MonadFork.labelThisThread`)
* `race` → `raceLabelled`
* `race_` → `raceLabelled_`
* `withAsync` → `withAsyncLabelled`
* `async` → `asyncLabelled`
* `concurrently` → `concurrentlyLabelled`
* `concurrently_` → `concurrentlyLabelled_`
#### 🔍 Usage not found
* `newTMVar`, `newTMVarIO`
* `forkIO` and its variants
#### ⚠️ Unresolved
* `newEmptyMVar`
* `newMVar`
> **Reason:** Labelled versions exist in
>
> * [`MonadMVar`
docs](https://hackage.haskell.org/package/io-classes-1.8.0.1/docs/Control-Concurrent-Class-MonadMVar.html)
> * [`io-classes`
changelog](https://github.com/input-output-hk/io-sim/blob/aadd3602b9b75640b042a02e0e62d10dd399b610/io-classes/CHANGELOG.md?plain=1#L23)
>
> However, their `IO` implementations are no-ops (labels are only
effective under `IOSim`).
> We need to decide whether to wrap these in our codebase or leave them
unlabelled for now.
---
<!-- Consider each and tick it off one way or the other -->
* [X] CHANGELOG updated or not needed
* [X] Documentation updated or not needed
* [X] Haddocks updated or not needed
* [X] No new TODOs introduced or explained herafter
0 commit comments