lens-5.3.3: Lenses, Folds and Traversals

Copyright | (C) 2012-16 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Control.Lens.Internal.Deque

Description

This module is designed to be imported qualified.

Synopsis

- data Deque a = BD !Int [a] !Int [a]
- size :: Deque a -> Int
- fromList :: [a] -> Deque a
- null :: Deque a -> Bool
- singleton :: a -> Deque a

# Documentation

data Deque a #

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

Constructors

BD !Int [a] !Int [a] |

#### Instances

Instances details

Alternative Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods empty :: Deque a # (<|>) :: Deque a -> Deque a -> Deque a # some :: Deque a -> Deque [a] # many :: Deque a -> Deque [a] #
Applicative Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods pure :: a -> Deque a # (<*>) :: Deque (a -> b) -> Deque a -> Deque b # liftA2 :: (a -> b -> c) -> Deque a -> Deque b -> Deque c # (*>) :: Deque a -> Deque b -> Deque b # (<*) :: Deque a -> Deque b -> Deque a #
Functor Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods fmap :: (a -> b) -> Deque a -> Deque b # (<$) :: a -> Deque b -> Deque a #
Monad Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods (>>=) :: Deque a -> (a -> Deque b) -> Deque b # (>>) :: Deque a -> Deque b -> Deque b # return :: a -> Deque a #
MonadPlus Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods mzero :: Deque a # mplus :: Deque a -> Deque a -> Deque a #
Foldable Deque # |

Instance details

Defined in Control.Lens.Internal.Deque

Methods

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

foldMap :: Monoid m => (a -> m) -> Deque a -> 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 # |
Instance details Defined in Control.Lens.Internal.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) #
Alt Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods (<!>) :: Deque a -> Deque a -> Deque a # some :: Applicative Deque => Deque a -> Deque [a] # many :: Applicative Deque => Deque a -> Deque [a] #
Apply Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods (<.>) :: Deque (a -> b) -> Deque a -> Deque b # (.>) :: Deque a -> Deque b -> Deque b # (<.) :: Deque a -> Deque b -> Deque a # liftF2 :: (a -> b -> c) -> Deque a -> Deque b -> Deque c #
Bind Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods (>>-) :: Deque a -> (a -> Deque b) -> Deque b # join :: Deque (Deque a) -> Deque a #
Plus Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods zero :: Deque a #
FoldableWithIndex Int Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods ifoldMap :: Monoid m => (Int -> a -> m) -> Deque a -> m # ifoldMap' :: Monoid m => (Int -> a -> m) -> Deque a -> m # 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 # |
Instance details Defined in Control.Lens.Internal.Deque Methods imap :: (Int -> a -> b) -> Deque a -> Deque b #
TraversableWithIndex Int Deque # |
Instance details Defined in Control.Lens.Internal.Deque Methods itraverse :: Applicative f => (Int -> a -> f b) -> Deque a -> f (Deque b) #
Monoid (Deque a) # |
Instance details Defined in Control.Lens.Internal.Deque Methods mempty :: Deque a # mappend :: Deque a -> Deque a -> Deque a # mconcat :: [Deque a] -> Deque a #
Semigroup (Deque a) # |
Instance details Defined in Control.Lens.Internal.Deque Methods (<>) :: Deque a -> Deque a -> Deque a # sconcat :: NonEmpty (Deque a) -> Deque a # stimes :: Integral b => b -> Deque a -> Deque a #
Show a => Show (Deque a) # |
Instance details Defined in Control.Lens.Internal.Deque Methods showsPrec :: Int -> Deque a -> ShowS # show :: Deque a -> String # showList :: [Deque a] -> ShowS #
Eq a => Eq (Deque a) # |
Instance details Defined in Control.Lens.Internal.Deque Methods (==) :: Deque a -> Deque a -> Bool # (/=) :: Deque a -> Deque a -> Bool #
Ord a => Ord (Deque a) # |
Instance details Defined in Control.Lens.Internal.Deque 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 #
Reversing (Deque a) # |
Instance details Defined in Control.Lens.Internal.Deque Methods reversing :: Deque a -> Deque a #
Cons (Deque a) (Deque b) a b # |
Instance details Defined in Control.Lens.Internal.Deque Methods _Cons :: Prism (Deque a) (Deque b) (a, Deque a) (b, Deque b) #
Snoc (Deque a) (Deque b) a b # |
Instance details Defined in Control.Lens.Internal.Deque Methods _Snoc :: Prism (Deque a) (Deque b) (Deque a, a) (Deque b, 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`.

    >>> Control.Lens.Internal.Deque.null empty
    True

    >>> Control.Lens.Internal.Deque.null (singleton 1)
    False

singleton :: a -> Deque a #

O(1). Generate a singleton `Deque`

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