Safe Haskell | None |
---|---|
Language | Haskell2010 |
Lazy 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.
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.
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.
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.