deque-0.4.4: Double-ended queues
Safe HaskellNone
LanguageHaskell2010

Deque.Strict.State

Description

Strict Deque API lifted to a State monad, "mtl"-style.

Synopsis

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.

null :: MonadState (Deque a) m => m Bool Source #

\(\mathcal{O}(1)\). Check whether deque is empty.

length :: MonadState (Deque a) m => m Int Source #

\(\mathcal{O}(1)\). Check whether deque is empty.

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.