Module
Data.CatQueue
- Package
- 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 aA 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 CatQueueUnfoldable1 CatQueueUnfoldable CatQueueTraversable CatQueueFunctor CatQueueApply CatQueueApplicative CatQueueBind CatQueueMonad CatQueueAlt CatQueuePlus CatQueueAlternative CatQueueMonadZero CatQueueMonadPlus CatQueue
#fromFoldable Source
fromFoldable :: forall a f. Foldable f => f a -> CatQueue aConvert 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