Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data FD n a
- data RD n a
- data Queue n a
- = Empty
- | Node10 !(Array n a) !(Queue (Twice n) a)
- | Node11 !(Array n a) !(Queue (Twice n) a) !(Array n a)
- | Node12 !(Array n a) !(Queue (Twice n) a) !(Array n a) !(Array n a)
- | Node20 !(Array n a) !(Array n a) (Queue (Twice n) a)
- | Node21 !(Array n a) !(Array n a) (Queue (Twice n) a) !(Array n a)
- | Node22 !(Array n a) !(Array n a) !(Queue (Twice n) a) !(Array n a) !(Array n a)
- | Node30 !(Array n a) !(Array n a) !(Array n a) (Queue (Twice n) a)
- | Node31 !(Array n a) !(Array n a) !(Array n a) (Queue (Twice n) a) !(Array n a)
- | Node32 !(Array n a) !(Array n a) !(Array n a) !(Queue (Twice n) a) !(Array n a) !(Array n a)
- data Queue_ n a
- matchNode :: Queue n a -> Queue_ n a
- pattern Node :: FD n a -> Queue (Twice n) a -> RD n a -> Queue n a
- data ViewA n a
- data ViewA2 n a
- singletonA :: Array n a -> Queue n a
- viewA :: Size n -> Queue n a -> ViewA n a
- empty :: Queue n a
- snocA :: Size n -> Queue n a -> Array n a -> Queue n a
- shiftA :: Size n -> Queue (Twice n) a -> Array n a -> Array n a -> ShiftedA n a
- shrift :: Size n -> Array (Twice n) a -> Queue (Twice n) a -> ShiftedA n a
- data ShiftedA n a = ShiftedA !(Array n a) !(Array n a) (Queue (Twice n) a)
Documentation
Empty | |
Node10 !(Array n a) !(Queue (Twice n) a) | |
Node11 !(Array n a) !(Queue (Twice n) a) !(Array n a) | |
Node12 !(Array n a) !(Queue (Twice n) a) !(Array n a) !(Array n a) | |
Node20 !(Array n a) !(Array n a) (Queue (Twice n) a) | |
Node21 !(Array n a) !(Array n a) (Queue (Twice n) a) !(Array n a) | |
Node22 !(Array n a) !(Array n a) !(Queue (Twice n) a) !(Array n a) !(Array n a) | |
Node30 !(Array n a) !(Array n a) !(Array n a) (Queue (Twice n) a) | |
Node31 !(Array n a) !(Array n a) !(Array n a) (Queue (Twice n) a) !(Array n a) | |
Node32 !(Array n a) !(Array n a) !(Array n a) !(Queue (Twice n) a) !(Array n a) !(Array n a) |
Instances
Functor (Queue n) Source # | |
Foldable (Queue n) Source # | |
Defined in Data.CompactSequence.Queue.Internal fold :: Monoid m => Queue n m -> m # foldMap :: Monoid m => (a -> m) -> Queue n a -> m # foldr :: (a -> b -> b) -> b -> Queue n a -> b # foldr' :: (a -> b -> b) -> b -> Queue n a -> b # foldl :: (b -> a -> b) -> b -> Queue n a -> b # foldl' :: (b -> a -> b) -> b -> Queue n a -> b # foldr1 :: (a -> a -> a) -> Queue n a -> a # foldl1 :: (a -> a -> a) -> Queue n a -> a # elem :: Eq a => a -> Queue n a -> Bool # maximum :: Ord a => Queue n a -> a # minimum :: Ord a => Queue n a -> a # | |
Traversable (Queue n) Source # | |
Eq a => Eq (Queue n a) Source # | |
Ord a => Ord (Queue n a) Source # | |
Defined in Data.CompactSequence.Queue.Internal | |
Show a => Show (Queue n a) Source # | |
singletonA :: Array n a -> Queue n a Source #
shiftA :: Size n -> Queue (Twice n) a -> Array n a -> Array n a -> ShiftedA n a Source #
Uncons from a node and snoc onto it. Ensure that if the operation is expensive then it leaves the node in a safe configuration. Why do we need this? Suppose we have
Two m Two
If we snoc onto this, the operation cascades, and we get
Two m Zero
Then when we view, we get
One m Zero
which is not safe.
Instead, we need to view first, getting
One m Two
immediately, then snoc on, cascading and getting
Three m Zero
which is safe.
If instead we have
One m One
we have to do the opposite: snoc then view. We might as well just write a dedicated shifting operation.