Module
Data.CatQueue
- Package
- purescript-catenable-lists
- Repository
- purescript/purescript-catenable-lists
This module defines a strict double-ended queue.
The queue implementation is based on a pair of lists where all
operations require O(1)
amortized time.
However, any single uncons
operation may run in O(n)
time.
See Simple and Efficient Purely Functional Queues and Dequeues (Okasaki 1995)
#CatQueue Source
data CatQueue a
A strict double-ended queue (dequeue) representated using a pair of lists.
Constructors
Instances
(Eq a) => Eq (CatQueue a)
(Ord a) => Ord (CatQueue a)
Semigroup (CatQueue a)
Monoid (CatQueue a)
(Show a) => Show (CatQueue a)
Foldable CatQueue
Unfoldable1 CatQueue
Unfoldable CatQueue
Traversable CatQueue
Functor CatQueue
Apply CatQueue
Applicative CatQueue
Bind CatQueue
Monad CatQueue
Alt CatQueue
Plus CatQueue
Alternative CatQueue
MonadZero CatQueue
MonadPlus CatQueue
#fromFoldable Source
fromFoldable :: forall a f. Foldable f => f a -> CatQueue a
Convert any Foldable
into a CatQueue
.
Running time: O(n)
- Modules
- Data.
CatList - Data.
CatQueue
Running time:
O(n) in the length of the second queue