License | BSD-3-Clause |
---|---|
Maintainer | Jamie Willis |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Exposes the instance of QueueLike
for RewindQueue
.
Since: 1.5.0.0
Synopsis
- data RewindQueue a
- empty :: RewindQueue a
- enqueue :: a -> RewindQueue a -> RewindQueue a
- enqueueAll :: [a] -> RewindQueue a -> RewindQueue a
- dequeue :: RewindQueue a -> (a, RewindQueue a)
- poke :: (a -> a) -> RewindQueue a -> (a, RewindQueue a)
- rewind :: Int -> RewindQueue a -> RewindQueue a
- null :: RewindQueue a -> Bool
- size :: RewindQueue a -> Int
- foldr :: (a -> b -> b) -> b -> RewindQueue a -> b
Documentation
data RewindQueue a Source #
Concrete FIFO Queue, with amortized constant operations.
Also keeps history of dequeued values, which can be undone in a LIFO manner.
Since: 1.5.0.0
Instances
QueueLike RewindQueue Source # | |
Defined in Parsley.Internal.Common.RewindQueue empty :: RewindQueue a Source # null :: RewindQueue a -> Bool Source # size :: RewindQueue a -> Int Source # enqueue :: a -> RewindQueue a -> RewindQueue a Source # dequeue :: RewindQueue a -> (a, RewindQueue a) Source # poke :: (a -> a) -> RewindQueue a -> (a, RewindQueue a) Source # enqueueAll :: [a] -> RewindQueue a -> RewindQueue a Source # | |
Eq a => Eq (RewindQueue a) Source # | |
Defined in Parsley.Internal.Common.RewindQueue.Impl (==) :: RewindQueue a -> RewindQueue a -> Bool # (/=) :: RewindQueue a -> RewindQueue a -> Bool # | |
Show a => Show (RewindQueue a) Source # | |
Defined in Parsley.Internal.Common.RewindQueue.Impl showsPrec :: Int -> RewindQueue a -> ShowS # show :: RewindQueue a -> String # showList :: [RewindQueue a] -> ShowS # |
empty :: RewindQueue a Source #
Construct an empty queue.
Since: 1.5.0.0
enqueue :: a -> RewindQueue a -> RewindQueue a Source #
Adds an element onto the end of the queue.
Since: 1.5.0.0
enqueueAll :: [a] -> RewindQueue a -> RewindQueue a Source #
Adds each of the elements onto the queue, from left-to-right.
Since: 1.5.0.0
dequeue :: RewindQueue a -> (a, RewindQueue a) Source #
Removes an element from the front of the queue.
Since: 1.5.0.0
poke :: (a -> a) -> RewindQueue a -> (a, RewindQueue a) Source #
modifies the head of the queue, without removal. Returns the old head
Since: 2.1.0.0
rewind :: Int -> RewindQueue a -> RewindQueue a Source #
Undoes the last \(n\) dequeue
operations but only if there are that many
available undos. Otherwise, it will throw an error.
Since: 1.5.0.0
null :: RewindQueue a -> Bool Source #
Is the queue empty?
Since: 1.5.0.0
size :: RewindQueue a -> Int Source #
Returns how many elements are in the queue.
Since: 1.5.0.0
foldr :: (a -> b -> b) -> b -> RewindQueue a -> b Source #
Folds the values in the queue. Undo history is not included.
Since: 1.5.0.0
Orphan instances
QueueLike RewindQueue Source # | |
empty :: RewindQueue a Source # null :: RewindQueue a -> Bool Source # size :: RewindQueue a -> Int Source # enqueue :: a -> RewindQueue a -> RewindQueue a Source # dequeue :: RewindQueue a -> (a, RewindQueue a) Source # poke :: (a -> a) -> RewindQueue a -> (a, RewindQueue a) Source # enqueueAll :: [a] -> RewindQueue a -> RewindQueue a Source # |