deque-0.4.2: Double-ended queues

Safe HaskellNone
LanguageHaskell2010

Deque.Lazy.State

Description

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

Synopsis

Documentation

map :: MonadState (Deque a) m => (a -> a) -> m () Source #

O(n). Modify each element of the queue.

prepend :: MonadState (Deque a) m => Deque a -> m () Source #

O(n). Add elements to the begginning.

append :: MonadState (Deque a) m => Deque a -> m () Source #

O(n). Add elements to the ending.

cons :: MonadState (Deque a) m => a -> m () Source #

O(1). Add element in the beginning.

snoc :: MonadState (Deque a) m => a -> m () Source #

O(1). Add element in the ending.

reverse :: MonadState (Deque a) m => m () Source #

O(1). Reverse the deque.

shiftLeft :: MonadState (Deque a) m => m () Source #

O(1), occasionally O(n). Move the first element to the end.

shiftRight :: MonadState (Deque a) m => m () Source #

O(1), occasionally O(n). Move the last element to the beginning.

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

O(n). Leave only the elements satisfying the predicate.

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

O(n). Leave only the specified amount of first elements.

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

O(n). Drop the specified amount of first elements.

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

O(n). Leave only the first elements satisfying the predicate.

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

O(n). Drop the first elements satisfying the predicate.

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

O(n). Return the first elements satisfying the predicate, removing them from the state.

uncons :: MonadState (Deque a) m => m (Maybe a) Source #

O(1), occasionally O(n). Get the first element if deque is not empty, removing the element.

unsnoc :: MonadState (Deque a) m => m (Maybe a) Source #

O(1), occasionally O(n). Get the last element if deque is not empty, removing the element.

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

O(1). Check whether deque is empty.

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

O(1). Check whether deque is empty.

head :: MonadState (Deque a) m => m (Maybe a) Source #

O(1), occasionally O(n). Get the first element if deque is not empty.

last :: MonadState (Deque a) m => m (Maybe a) Source #

O(1), occasionally O(n). Get the last element if deque is not empty.

tail :: MonadState (Deque a) m => m () Source #

O(1), occasionally O(n). Keep all elements but the first one.

init :: MonadState (Deque a) m => m () Source #

O(1), occasionally O(n). Keep all elements but the last one.