lens-4.15.4: Lenses, Folds and Traversals

Copyright(C) 2012-16 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell98

Control.Lens.Internal.Deque

Description

This module is designed to be imported qualified.

Synopsis

Documentation

data Deque a #

A Banker's deque based on Chris Okasaki's "Purely Functional Data Structures"

Constructors

BD !Int [a] !Int [a] 

Instances

Monad Deque # 

Methods

(>>=) :: Deque a -> (a -> Deque b) -> Deque b #

(>>) :: Deque a -> Deque b -> Deque b #

return :: a -> Deque a #

fail :: String -> Deque a #

Functor Deque # 

Methods

fmap :: (a -> b) -> Deque a -> Deque b #

(<$) :: a -> Deque b -> Deque a #

Applicative Deque # 

Methods

pure :: a -> Deque a #

(<*>) :: Deque (a -> b) -> Deque a -> Deque b #

(*>) :: Deque a -> Deque b -> Deque b #

(<*) :: Deque a -> Deque b -> Deque a #

Foldable Deque # 

Methods

fold :: Monoid m => Deque m -> m #

foldMap :: Monoid m => (a -> m) -> Deque a -> m #

foldr :: (a -> b -> b) -> b -> Deque a -> b #

foldr' :: (a -> b -> b) -> b -> Deque a -> b #

foldl :: (b -> a -> b) -> b -> Deque a -> b #

foldl' :: (b -> a -> b) -> b -> Deque a -> b #

foldr1 :: (a -> a -> a) -> Deque a -> a #

foldl1 :: (a -> a -> a) -> Deque a -> a #

toList :: Deque a -> [a] #

null :: Deque a -> Bool #

length :: Deque a -> Int #

elem :: Eq a => a -> Deque a -> Bool #

maximum :: Ord a => Deque a -> a #

minimum :: Ord a => Deque a -> a #

sum :: Num a => Deque a -> a #

product :: Num a => Deque a -> a #

Traversable Deque # 

Methods

traverse :: Applicative f => (a -> f b) -> Deque a -> f (Deque b) #

sequenceA :: Applicative f => Deque (f a) -> f (Deque a) #

mapM :: Monad m => (a -> m b) -> Deque a -> m (Deque b) #

sequence :: Monad m => Deque (m a) -> m (Deque a) #

Alternative Deque # 

Methods

empty :: Deque a #

(<|>) :: Deque a -> Deque a -> Deque a #

some :: Deque a -> Deque [a] #

many :: Deque a -> Deque [a] #

MonadPlus Deque # 

Methods

mzero :: Deque a #

mplus :: Deque a -> Deque a -> Deque a #

Plus Deque # 

Methods

zero :: Deque a #

Alt Deque # 

Methods

(<!>) :: Deque a -> Deque a -> Deque a #

some :: Applicative Deque => Deque a -> Deque [a] #

many :: Applicative Deque => Deque a -> Deque [a] #

Apply Deque # 

Methods

(<.>) :: Deque (a -> b) -> Deque a -> Deque b #

(.>) :: Deque a -> Deque b -> Deque b #

(<.) :: Deque a -> Deque b -> Deque a #

Bind Deque # 

Methods

(>>-) :: Deque a -> (a -> Deque b) -> Deque b #

join :: Deque (Deque a) -> Deque a #

TraversableWithIndex Int Deque # 

Methods

itraverse :: Applicative f => (Int -> a -> f b) -> Deque a -> f (Deque b) #

itraversed :: (Indexable Int p, Applicative f) => p a (f b) -> Deque a -> f (Deque b) #

FoldableWithIndex Int Deque # 

Methods

ifoldMap :: Monoid m => (Int -> a -> m) -> Deque a -> m #

ifolded :: (Indexable Int p, Contravariant f, Applicative f) => p a (f a) -> Deque a -> f (Deque a) #

ifoldr :: (Int -> a -> b -> b) -> b -> Deque a -> b #

ifoldl :: (Int -> b -> a -> b) -> b -> Deque a -> b #

ifoldr' :: (Int -> a -> b -> b) -> b -> Deque a -> b #

ifoldl' :: (Int -> b -> a -> b) -> b -> Deque a -> b #

FunctorWithIndex Int Deque # 

Methods

imap :: (Int -> a -> b) -> Deque a -> Deque b #

imapped :: (Indexable Int p, Settable f) => p a (f b) -> Deque a -> f (Deque b) #

Eq a => Eq (Deque a) # 

Methods

(==) :: Deque a -> Deque a -> Bool #

(/=) :: Deque a -> Deque a -> Bool #

Ord a => Ord (Deque a) # 

Methods

compare :: Deque a -> Deque a -> Ordering #

(<) :: Deque a -> Deque a -> Bool #

(<=) :: Deque a -> Deque a -> Bool #

(>) :: Deque a -> Deque a -> Bool #

(>=) :: Deque a -> Deque a -> Bool #

max :: Deque a -> Deque a -> Deque a #

min :: Deque a -> Deque a -> Deque a #

Show a => Show (Deque a) # 

Methods

showsPrec :: Int -> Deque a -> ShowS #

show :: Deque a -> String #

showList :: [Deque a] -> ShowS #

Semigroup (Deque a) # 

Methods

(<>) :: Deque a -> Deque a -> Deque a #

sconcat :: NonEmpty (Deque a) -> Deque a #

stimes :: Integral b => b -> Deque a -> Deque a #

Monoid (Deque a) # 

Methods

mempty :: Deque a #

mappend :: Deque a -> Deque a -> Deque a #

mconcat :: [Deque a] -> Deque a #

Reversing (Deque a) # 

Methods

reversing :: Deque a -> Deque a #

Snoc (Deque a) (Deque b) a b # 

Methods

_Snoc :: Prism (Deque a) (Deque b) (Deque a, a) (Deque b, b) #

Cons (Deque a) (Deque b) a b # 

Methods

_Cons :: Prism (Deque a) (Deque b) (a, Deque a) (b, Deque b) #

size :: Deque a -> Int #

O(1). Calculate the size of a Deque

>>> size (fromList [1,4,6])
3

fromList :: [a] -> Deque a #

O(n) amortized. Construct a Deque from a list of values.

>>> fromList [1,2]
BD 1 [1] 1 [2]

null :: Deque a -> Bool #

O(1). Determine if a Deque is empty.

>>> null empty
True
>>> null (singleton 1)
False

singleton :: a -> Deque a #

O(1). Generate a singleton Deque

>>> singleton 1
BD 1 [1] 0 []