Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Deque a
- fromStrict :: Deque a -> Deque a
- toStrict :: Deque a -> Deque a
- fromConsAndSnocLists :: [a] -> [a] -> Deque a
- cons :: a -> Deque a -> Deque a
- snoc :: a -> Deque a -> Deque a
- reverse :: Deque a -> Deque a
- shiftLeft :: Deque a -> Deque a
- shiftRight :: Deque a -> Deque a
- filter :: (a -> Bool) -> Deque a -> Deque a
- take :: Int -> Deque a -> Deque a
- drop :: Int -> Deque a -> Deque a
- takeWhile :: (a -> Bool) -> Deque a -> Deque a
- dropWhile :: (a -> Bool) -> Deque a -> Deque a
- span :: (a -> Bool) -> Deque a -> (Deque a, Deque a)
- uncons :: Deque a -> Maybe (a, Deque a)
- unsnoc :: Deque a -> Maybe (a, Deque a)
- null :: Deque a -> Bool
- head :: Deque a -> Maybe a
- last :: Deque a -> Maybe a
- tail :: Deque a -> Deque a
- init :: Deque a -> Deque a
Documentation
Lazy double-ended queue (aka Dequeue or Deque) based on head-tail linked list.
Instances
Monad Deque Source # | |
Functor Deque Source # | |
MonadFail Deque Source # | |
Defined in Deque.Lazy.Defs | |
Applicative Deque Source # | |
Foldable Deque Source # | |
Defined in Deque.Lazy.Defs fold :: Monoid m => Deque m -> m # foldMap :: Monoid m => (a -> m) -> Deque a -> m # foldr :: (a -> b -> b) -> b -> Deque a -> b # foldr' :: (a -> b -> b) -> b -> Deque a -> b # foldl :: (b -> a -> b) -> b -> Deque a -> b # foldl' :: (b -> a -> b) -> b -> Deque a -> b # foldr1 :: (a -> a -> a) -> Deque a -> a # foldl1 :: (a -> a -> a) -> Deque a -> a # elem :: Eq a => a -> Deque a -> Bool # maximum :: Ord a => Deque a -> a # minimum :: Ord a => Deque a -> a # | |
Traversable Deque Source # | |
Alternative Deque Source # | |
MonadPlus Deque Source # | |
IsList (Deque a) Source # | O(1). |
Eq a => Eq (Deque a) Source # | |
Show a => Show (Deque a) Source # | |
Semigroup (Deque a) Source # | |
Monoid (Deque a) Source # | |
type Item (Deque a) Source # | |
Defined in Deque.Lazy.Defs |
fromStrict :: Deque a -> Deque a Source #
Convert strict deque to lazy deque.
fromConsAndSnocLists :: [a] -> [a] -> Deque a Source #
O(1). Construct from cons and snoc lists.
shiftLeft :: Deque a -> Deque a Source #
O(1), occasionally O(n). Move the first element to the end.
λ toList . shiftLeft $ fromList [1,2,3] [2,3,1]
shiftRight :: Deque a -> Deque a Source #
O(1), occasionally O(n). Move the last element to the beginning.
λ toList . shiftRight $ fromList [1,2,3] [3,1,2]
filter :: (a -> Bool) -> Deque a -> Deque a Source #
O(n). Leave only the elements satisfying the predicate.
takeWhile :: (a -> Bool) -> Deque a -> Deque a Source #
O(n). Leave only the first elements satisfying the predicate.
dropWhile :: (a -> Bool) -> Deque a -> Deque a Source #
O(n). Drop the first elements satisfying the predicate.
uncons :: Deque a -> Maybe (a, Deque a) Source #
O(1), occasionally O(n). Get the first element and deque without it if it's not empty.
unsnoc :: Deque a -> Maybe (a, Deque a) Source #
O(1), occasionally O(n). Get the last element and deque without it if it's not empty.
head :: Deque a -> Maybe a Source #
O(1), occasionally O(n). Get the first element if deque is not empty.
last :: Deque a -> Maybe a Source #
O(1), occasionally O(n). Get the last element if deque is not empty.