HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Moduleconcurrency-1.11.0.3Haskell2010

Control.Concurrent.Classy.STM.TQueue

A TQueue is like a TChan, with two important differences:

  • it has faster throughput than both TChan and Chan (although the costs are amortised, so the cost of individual operations can vary a lot).

  • it does not provide equivalents of the dupTChan and cloneTChan operations.

The implementation is based on the traditional purely-functional queue representation that uses two lists to obtain amortised O(1) enqueue and dequeue operations.

Deviations: TQueue as defined here does not have an Eq instance, this is because the MonadSTM TVar type does not have an Eq constraint. Furthermore, the newTQueueIO function is not provided.

Contents
  1. TQueue
Synopsis

TQueue

valuepeekTQueue :: MonadSTM stm => TQueue stm a -> stm a

Get the next value from the TQueue without removing it, retrying if the channel is empty.