deque-0.4.4.1: Double-ended queues

Safe Haskell | Safe-Inferred
Language | Haskell2010

Deque.Strict.Reader

Description

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

Synopsis

- map :: MonadReader (Deque a) m => (a -> b) -> m (Deque b)
- prepend :: MonadReader (Deque a) m => Deque a -> m (Deque a)
- append :: MonadReader (Deque a) m => Deque a -> m (Deque a)
- cons :: MonadReader (Deque a) m => a -> m (Deque a)
- snoc :: MonadReader (Deque a) m => a -> m (Deque a)
- reverse :: MonadReader (Deque a) m => m (Deque a)
- shiftLeft :: MonadReader (Deque a) m => m (Deque a)
- shiftRight :: MonadReader (Deque a) m => m (Deque a)
- filter :: MonadReader (Deque a) m => (a -> Bool) -> m (Deque a)
- take :: MonadReader (Deque a) m => Int -> m (Deque a)
- drop :: MonadReader (Deque a) m => Int -> m (Deque a)
- takeWhile :: MonadReader (Deque a) m => (a -> Bool) -> m (Deque a)
- dropWhile :: MonadReader (Deque a) m => (a -> Bool) -> m (Deque a)
- span :: MonadReader (Deque a) m => (a -> Bool) -> m (Deque a, Deque a)
- uncons :: MonadReader (Deque a) m => m (Maybe a, Deque a)
- unsnoc :: MonadReader (Deque a) m => m (Maybe a, Deque a)
- null :: MonadReader (Deque a) m => m Bool
- length :: MonadReader (Deque a) m => m Int
- head :: MonadReader (Deque a) m => m (Maybe a)
- last :: MonadReader (Deque a) m => m (Maybe a)
- tail :: MonadReader (Deque a) m => m (Deque a)
- init :: MonadReader (Deque a) m => m (Deque a)

# 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.