-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | mutable ring buffers with atomic updates in GHC Haskell
--
-- mutable ring buffers with atomic updates in GHC Haskell, using the
-- contiguous api internally to provide multiple array backends
@package ring-buffers
@version 0.2
-- | A concurrent, mutable ring buffer that supports atomic updates. This
-- module supports buffers containing all lifted types. If you are using
-- a buffer which contains some unboxable or unliftable type, consider
-- using Unboxed or Unlifted.
module RingBuffers.Lifted
-- | A concurrent, mutable ring buffer that supports atomic updates.
data RingBuffer a
-- | Return a new ring buffer of the specified size.
new :: () => Int -> IO (RingBuffer a)
-- | Reset the buffer to its empty state.
clear :: () => RingBuffer a -> IO ()
-- | Add an item to the end of the buffer.
append :: () => a -> RingBuffer a -> IO ()
-- | Write multiple items to the end of the ring.
--
-- Ignores any elements of the input array whose indices are higher than
-- the length of the ring buffer.
extend :: () => Array a -> RingBuffer a -> IO ()
-- | Get the maximum number of items the ring can contain
capacity :: () => RingBuffer a -> IO Int
-- | Get the current filled length of the ring
filledLength :: () => RingBuffer a -> IO Int
-- | Retrieve the <math>th most-recently added item of the ring
latest :: () => RingBuffer a -> Int -> IO (Maybe a)
-- | Retrieve the <math>th most-recently added item of the ring
--
-- Note: This function may exhibit undefined behaviour if the
-- index is out-of-bounds or uninitialised.
unsafeLatest :: () => RingBuffer a -> Int -> IO a
-- | Execute the given action with the items of the ring, accumulating its
-- results.
foldMap :: Monoid b => RingBuffer a -> (a -> IO b) -> IO b
-- | Convert the entire contents of the ring into a list, with the most
-- recently added element at the head.
toList :: () => RingBuffer a -> IO [a]
-- | A concurrent, mutable ring buffer that supports atomic updates. This
-- module is most efficient on buffers containing unlifted types.
module RingBuffers.Unboxed
-- | A concurrent, mutable ring buffer that supports atomic updates.
data RingBuffer a
-- | Return a new ring buffer of the specified size.
new :: Prim a => Int -> IO (RingBuffer a)
-- | Reset the buffer to its empty state.
clear :: Prim a => RingBuffer a -> IO ()
-- | Add an item to the end of the buffer.
append :: Prim a => a -> RingBuffer a -> IO ()
-- | Write multiple items to the end of the ring.
--
-- Ignores any elements of the input array whose indices are higher than
-- the length of the ring buffer.
extend :: Prim a => PrimArray a -> RingBuffer a -> IO ()
-- | Get the maximum number of items the ring can contain
capacity :: Prim a => RingBuffer a -> IO Int
-- | Get the current filled length of the ring
filledLength :: Prim a => RingBuffer a -> IO Int
-- | Retrieve the <math>th most-recently added item of the ring
latest :: Prim a => RingBuffer a -> Int -> IO (Maybe a)
-- | Retrieve the <math>th most-recently added item of the ring
--
-- Note: This function may exhibit undefined behaviour if the
-- index is out-of-bounds or uninitialised.
unsafeLatest :: Prim a => RingBuffer a -> Int -> IO a
-- | Execute the given action with the items of the ring, accumulating its
-- results.
foldMap :: (Prim a, Monoid b) => RingBuffer a -> (a -> IO b) -> IO b
-- | Convert the entire contents of the ring into a list, with the most
-- recently added element at the head.
toList :: Prim a => RingBuffer a -> IO [a]
-- | A concurrent, mutable ring buffer that supports atomic updates. This
-- module is most efficient on buffers containing unboxed types.
module RingBuffers.Unlifted
-- | A concurrent, mutable ring buffer that supports atomic updates.
data RingBuffer a
-- | Return a new ring buffer of the specified size.
new :: PrimUnlifted a => Int -> IO (RingBuffer a)
-- | Reset the buffer to its empty state.
clear :: PrimUnlifted a => RingBuffer a -> IO ()
-- | Add an item to the end of the buffer.
append :: PrimUnlifted a => a -> RingBuffer a -> IO ()
-- | Write multiple items to the end of the ring.
--
-- Ignores any elements of the input array whose indices are higher than
-- the length of the ring buffer.
extend :: PrimUnlifted a => UnliftedArray a -> RingBuffer a -> IO ()
-- | Get the maximum number of items the ring can contain
capacity :: PrimUnlifted a => RingBuffer a -> IO Int
-- | Get the current filled length of the ring
filledLength :: PrimUnlifted a => RingBuffer a -> IO Int
-- | Retrieve the <math>th most-recently added item of the ring
latest :: PrimUnlifted a => RingBuffer a -> Int -> IO (Maybe a)
-- | Retrieve the <math>th most-recently added item of the ring
--
-- Note: This function may exhibit undefined behaviour if the
-- index is out-of-bounds or uninitialised.
unsafeLatest :: PrimUnlifted a => RingBuffer a -> Int -> IO a
-- | Execute the given action with the items of the ring, accumulating its
-- results.
foldMap :: (PrimUnlifted a, Monoid b) => RingBuffer a -> (a -> IO b) -> IO b
-- | Convert the entire contents of the ring into a list, with the most
-- recently added element at the head.
toList :: PrimUnlifted a => RingBuffer a -> IO [a]