module Deque.Lazy.Reader
where
import Deque.Prelude hiding (tail, init, last, head, null, dropWhile, takeWhile, reverse)
import Deque.Lazy (Deque)
import qualified Deque.Lazy as Deque
import qualified Deque.Prelude as Prelude
map :: MonadReader (Deque a) m => (a -> b) -> m (Deque b)
map f = reader (fmap f)
prepend :: MonadReader (Deque a) m => Deque a -> m (Deque a)
prepend deque = reader (deque <>)
append :: MonadReader (Deque a) m => Deque a -> m (Deque a)
append deque = reader (<> deque)
cons :: MonadReader (Deque a) m => a -> m (Deque a)
cons a = reader (Deque.cons a)
snoc :: MonadReader (Deque a) m => a -> m (Deque a)
snoc a = reader (Deque.snoc a)
reverse :: MonadReader (Deque a) m => m (Deque a)
reverse = reader Deque.reverse
shiftLeft :: MonadReader (Deque a) m => m (Deque a)
shiftLeft = reader Deque.shiftLeft
shiftRight :: MonadReader (Deque a) m => m (Deque a)
shiftRight = reader Deque.shiftRight
filter :: MonadReader (Deque a) m => (a -> Bool) -> m (Deque a)
filter predicate = reader (Deque.filter predicate)
take :: MonadReader (Deque a) m => Int -> m (Deque a)
take = reader . Deque.take
drop :: MonadReader (Deque a) m => Int -> m (Deque a)
drop = reader . Deque.drop
takeWhile :: MonadReader (Deque a) m => (a -> Bool) -> m (Deque a)
takeWhile predicate = reader (Deque.takeWhile predicate)
dropWhile :: MonadReader (Deque a) m => (a -> Bool) -> m (Deque a)
dropWhile predicate = reader (Deque.dropWhile predicate)
span :: MonadReader (Deque a) m => (a -> Bool) -> m (Deque a, Deque a)
span predicate = reader (Deque.span predicate)
uncons :: MonadReader (Deque a) m => m (Maybe a, Deque a)
uncons = reader (\ deque -> case Deque.uncons deque of
Nothing -> (Nothing, deque)
Just (a, newDeque) -> (Just a, newDeque))
unsnoc :: MonadReader (Deque a) m => m (Maybe a, Deque a)
unsnoc = reader (\ deque -> case Deque.unsnoc deque of
Nothing -> (Nothing, deque)
Just (a, newDeque) -> (Just a, newDeque))
null :: MonadReader (Deque a) m => m Bool
null = reader Deque.null
length :: MonadReader (Deque a) m => m Int
length = reader Prelude.length
head :: MonadReader (Deque a) m => m (Maybe a)
head = reader Deque.head
last :: MonadReader (Deque a) m => m (Maybe a)
last = reader Deque.last
tail :: MonadReader (Deque a) m => m (Deque a)
tail = reader Deque.tail
init :: MonadReader (Deque a) m => m (Deque a)
init = reader Deque.init