Safe Haskell | None |
---|---|
Language | Haskell2010 |
Strict Deque API lifted to a State monad, "mtl"-style.
Synopsis
- map :: MonadState (Deque a) m => (a -> a) -> m ()
- prepend :: MonadState (Deque a) m => Deque a -> m ()
- append :: MonadState (Deque a) m => Deque a -> m ()
- cons :: MonadState (Deque a) m => a -> m ()
- snoc :: MonadState (Deque a) m => a -> m ()
- reverse :: MonadState (Deque a) m => m ()
- shiftLeft :: MonadState (Deque a) m => m ()
- shiftRight :: MonadState (Deque a) m => m ()
- filter :: MonadState (Deque a) m => (a -> Bool) -> m ()
- take :: MonadState (Deque a) m => Int -> m ()
- drop :: MonadState (Deque a) m => Int -> m ()
- takeWhile :: MonadState (Deque a) m => (a -> Bool) -> m ()
- dropWhile :: MonadState (Deque a) m => (a -> Bool) -> m ()
- span :: MonadState (Deque a) m => (a -> Bool) -> m (Deque a)
- uncons :: MonadState (Deque a) m => m (Maybe a)
- unsnoc :: MonadState (Deque a) m => m (Maybe a)
- null :: MonadState (Deque a) m => m Bool
- length :: MonadState (Deque a) m => m Int
- head :: MonadState (Deque a) m => m (Maybe a)
- last :: MonadState (Deque a) m => m (Maybe a)
- tail :: MonadState (Deque a) m => m ()
- init :: MonadState (Deque a) m => m ()
Documentation
map :: MonadState (Deque a) m => (a -> a) -> m () Source #
\(\mathcal{O}(n)\). Modify each element of the queue.
prepend :: MonadState (Deque a) m => Deque a -> m () Source #
\(\mathcal{O}(n)\). Add elements to the begginning.
append :: MonadState (Deque a) m => Deque a -> m () Source #
\(\mathcal{O}(n)\). Add elements to the ending.
cons :: MonadState (Deque a) m => a -> m () Source #
\(\mathcal{O}(1)\). Add element in the beginning.
snoc :: MonadState (Deque a) m => a -> m () Source #
\(\mathcal{O}(1)\). Add element in the ending.
reverse :: MonadState (Deque a) m => m () Source #
\(\mathcal{O}(1)\). Reverse the deque.
shiftLeft :: MonadState (Deque a) m => m () Source #
\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Move the first element to the end.
shiftRight :: MonadState (Deque a) m => m () Source #
\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Move the last element to the beginning.
filter :: MonadState (Deque a) m => (a -> Bool) -> m () Source #
\(\mathcal{O}(n)\). Leave only the elements satisfying the predicate.
take :: MonadState (Deque a) m => Int -> m () Source #
\(\mathcal{O}(n)\). Leave only the specified amount of first elements.
drop :: MonadState (Deque a) m => Int -> m () Source #
\(\mathcal{O}(n)\). Drop the specified amount of first elements.
takeWhile :: MonadState (Deque a) m => (a -> Bool) -> m () Source #
\(\mathcal{O}(n)\). Leave only the first elements satisfying the predicate.
dropWhile :: MonadState (Deque a) m => (a -> Bool) -> m () Source #
\(\mathcal{O}(n)\). Drop the first elements satisfying the predicate.
span :: MonadState (Deque a) m => (a -> Bool) -> m (Deque a) Source #
\(\mathcal{O}(n)\). Return the first elements satisfying the predicate, removing them from the state.
uncons :: MonadState (Deque a) m => m (Maybe a) Source #
\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Get the first element if deque is not empty, removing the element.
unsnoc :: MonadState (Deque a) m => m (Maybe a) Source #
\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Get the last element if deque is not empty, removing the element.
head :: MonadState (Deque a) m => m (Maybe a) Source #
\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Get the first element if deque is not empty.
last :: MonadState (Deque a) m => m (Maybe a) Source #
\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Get the last element if deque is not empty.
tail :: MonadState (Deque a) m => m () Source #
\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Keep all elements but the first one.
init :: MonadState (Deque a) m => m () Source #
\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Keep all elements but the last one.