deque-0.4.4: Double-ended queues
Safe HaskellNone
LanguageHaskell2010

Deque.Strict.Reader

Description

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

Synopsis

Documentation

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

\(\mathcal{O}(n)\). Modify each element of the queue.

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

\(\mathcal{O}(n)\). Add elements to the begginning.

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

\(\mathcal{O}(n)\). Add elements to the ending.

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

\(\mathcal{O}(1)\). Add element in the beginning.

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

\(\mathcal{O}(1)\). Add element in the ending.

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

\(\mathcal{O}(1)\). Reverse the deque.

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

\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Move the first element to the end.

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

\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Move the last element to the beginning.

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

\(\mathcal{O}(n)\). Leave only the elements satisfying the predicate.

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

\(\mathcal{O}(n)\). Leave only the specified amount of first elements.

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

\(\mathcal{O}(n)\). Drop the specified amount of first elements.

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

\(\mathcal{O}(n)\). Leave only the first elements satisfying the predicate.

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

\(\mathcal{O}(n)\). Drop the first elements satisfying the predicate.

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

\(\mathcal{O}(n)\). Same as (,) <$> takeWhile predicate <*> dropWhile predicate.

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

\(\mathcal{O}(1)\), occasionally \(\mathcal{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 #

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

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

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

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

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

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

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

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

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

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

\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Keep all elements but the first one.

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

\(\mathcal{O}(1)\), occasionally \(\mathcal{O}(n)\). Keep all elements but the last one.