Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data RingBuffer a
- new :: Int -> IO (RingBuffer a)
- clear :: RingBuffer a -> IO ()
- append :: a -> RingBuffer a -> IO ()
- capacity :: RingBuffer a -> IO Int
- filledLength :: RingBuffer a -> IO Int
- latest :: RingBuffer a -> Int -> IO (Maybe a)
- foldMap :: Monoid b => RingBuffer a -> (a -> IO b) -> IO b
Documentation
data RingBuffer a Source #
A concurrent, mutable ring buffer that supports atomic updates.
:: Int | capacity of buffer |
-> IO (RingBuffer a) |
Return a new ring buffer of the specified size.
append :: a -> RingBuffer a -> IO () Source #
Add an item to the end of the buffer.
filledLength :: RingBuffer a -> IO Int Source #
Get the current filled length of the ring