Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data RingBuffer a
- new :: Natural -> IO (RingBuffer a)
- peek :: RingBuffer a -> IO (Maybe a)
- reset :: RingBuffer a -> RingBuffer a
- push :: a -> RingBuffer a -> IO (RingBuffer a, Maybe a)
- push_ :: a -> RingBuffer a -> IO (RingBuffer a)
- pushMany :: [a] -> RingBuffer a -> IO (RingBuffer a, [a])
- pop :: RingBuffer a -> IO (RingBuffer a, Maybe a)
- pop_ :: RingBuffer a -> IO (RingBuffer a)
- flush :: RingBuffer a -> IO (RingBuffer a, [a])
- flush_ :: RingBuffer a -> IO (RingBuffer a)
- flushN :: Natural -> RingBuffer a -> IO (RingBuffer a, [a])
- flushWhile :: (a -> Bool) -> RingBuffer a -> IO (RingBuffer a, [a])
- flushWhile_ :: (a -> Bool) -> RingBuffer a -> IO (RingBuffer a)
- unpushWhile :: (a -> Bool) -> RingBuffer a -> IO (RingBuffer a, [a])
- unpushWhile_ :: (a -> Bool) -> RingBuffer a -> IO (RingBuffer a)
Documentation
data RingBuffer a #
new :: Natural -> IO (RingBuffer a) #
peek :: RingBuffer a -> IO (Maybe a) #
reset :: RingBuffer a -> RingBuffer a #
Add elements
push :: a -> RingBuffer a -> IO (RingBuffer a, Maybe a) #
Push a
to buffer, possibly returning carry and the new ringbuffer.
push_ :: a -> RingBuffer a -> IO (RingBuffer a) #
pushMany :: [a] -> RingBuffer a -> IO (RingBuffer a, [a]) #
Push many as
to ringBuffer
, returning overflow.
Remove oldest elements
pop :: RingBuffer a -> IO (RingBuffer a, Maybe a) #
Pop oldest item.
pop_ :: RingBuffer a -> IO (RingBuffer a) #
flush :: RingBuffer a -> IO (RingBuffer a, [a]) #
flush_ :: RingBuffer a -> IO (RingBuffer a) #
flushN :: Natural -> RingBuffer a -> IO (RingBuffer a, [a]) #
Pop n
oldest items, or less if buffer fill is smaller.
flushWhile :: (a -> Bool) -> RingBuffer a -> IO (RingBuffer a, [a]) #
flushWhile_ :: (a -> Bool) -> RingBuffer a -> IO (RingBuffer a) #
Remove newest elements
unpushWhile :: (a -> Bool) -> RingBuffer a -> IO (RingBuffer a, [a]) #
Unpush newest items from buffer while predicate matches.
unpushWhile_ :: (a -> Bool) -> RingBuffer a -> IO (RingBuffer a) #