deque-0.4.3: Double-ended queues

Safe HaskellNone
LanguageHaskell2010

Deque.Lazy.Reader

Description

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

Synopsis

Documentation

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

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

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

O(n). Add elements to the begginning.

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

O(n). Add elements to the ending.

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

O(1). Add element in the beginning.

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

O(1). Add element in the ending.

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

O(1). Reverse the deque.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

O(n). Same as (,) <$> takeWhile predicate <*> dropWhile predicate.

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

O(1), occasionally O(n). Get the first element and deque without it if it's not empty.

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

O(1), occasionally O(n). Get the last element and deque without it if it's not empty.

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

O(1). Check whether deque is empty.

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

O(1). Check whether deque is empty.

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

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

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

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

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

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

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

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