This is an implementation of a fixed-size ring buffer in STM. As a bounded queue, it outperforms Control.Concurrent.STM.TBQueue in benchmarks. However, it offers a more general interface (you can write / read / flush from both ends)
A module mimicking the interface of Control.Concurrent.STM.TBQueue is provided, so that you can easily substitute it for Control.Concurrent.STM.TBQueue.