hgeometry-0.7.0.0: Geometric Algorithms, Data structures, and Data types.

Data.Seq2

Synopsis

# Documentation

data Seq2 a Source #

Basically Data.Sequence but with the guarantee that the list contains at least two elements.

Constructors

 Seq2 a (Seq a) a
Instances
 Source # Instance detailsDefined in Data.Seq2 Methodsfmap :: (a -> b) -> Seq2 a -> Seq2 b #(<$) :: a -> Seq2 b -> Seq2 a # Source # Instance detailsDefined in Data.Seq2 Methodsfold :: Monoid m => Seq2 m -> m #foldMap :: Monoid m => (a -> m) -> Seq2 a -> m #foldr :: (a -> b -> b) -> b -> Seq2 a -> b #foldr' :: (a -> b -> b) -> b -> Seq2 a -> b #foldl :: (b -> a -> b) -> b -> Seq2 a -> b #foldl' :: (b -> a -> b) -> b -> Seq2 a -> b #foldr1 :: (a -> a -> a) -> Seq2 a -> a #foldl1 :: (a -> a -> a) -> Seq2 a -> a #toList :: Seq2 a -> [a] #null :: Seq2 a -> Bool #length :: Seq2 a -> Int #elem :: Eq a => a -> Seq2 a -> Bool #maximum :: Ord a => Seq2 a -> a #minimum :: Ord a => Seq2 a -> a #sum :: Num a => Seq2 a -> a #product :: Num a => Seq2 a -> a # Source # Instance detailsDefined in Data.Seq2 Methodstraverse :: Applicative f => (a -> f b) -> Seq2 a -> f (Seq2 b) #sequenceA :: Applicative f => Seq2 (f a) -> f (Seq2 a) #mapM :: Monad m => (a -> m b) -> Seq2 a -> m (Seq2 b) #sequence :: Monad m => Seq2 (m a) -> m (Seq2 a) # Eq a => Eq (Seq2 a) Source # Instance detailsDefined in Data.Seq2 Methods(==) :: Seq2 a -> Seq2 a -> Bool #(/=) :: Seq2 a -> Seq2 a -> Bool # Ord a => Ord (Seq2 a) Source # Instance detailsDefined in Data.Seq2 Methodscompare :: Seq2 a -> Seq2 a -> Ordering #(<) :: Seq2 a -> Seq2 a -> Bool #(<=) :: Seq2 a -> Seq2 a -> Bool #(>) :: Seq2 a -> Seq2 a -> Bool #(>=) :: Seq2 a -> Seq2 a -> Bool #max :: Seq2 a -> Seq2 a -> Seq2 a #min :: Seq2 a -> Seq2 a -> Seq2 a # Show a => Show (Seq2 a) Source # Instance detailsDefined in Data.Seq2 MethodsshowsPrec :: Int -> Seq2 a -> ShowS #show :: Seq2 a -> String #showList :: [Seq2 a] -> ShowS # Source # Instance detailsDefined in Data.Seq2 Methods(<>) :: Seq2 a -> Seq2 a -> Seq2 a #sconcat :: NonEmpty (Seq2 a) -> Seq2 a #stimes :: Integral b => b -> Seq2 a -> Seq2 a # Arbitrary a => Arbitrary (Seq2 a) # Instance detailsDefined in Test.QuickCheck.HGeometryInstances Methodsarbitrary :: Gen (Seq2 a) #shrink :: Seq2 a -> [Seq2 a] # Ixed (Seq2 a) Source # Instance detailsDefined in Data.Seq2 Methodsix :: Index (Seq2 a) -> Traversal' (Seq2 a) (IxValue (Seq2 a)) # type Index (Seq2 a) Source # Instance detailsDefined in Data.Seq2 type Index (Seq2 a) = Int type IxValue (Seq2 a) Source # Instance detailsDefined in Data.Seq2 type IxValue (Seq2 a) = a duo :: a -> a -> Seq2 a Source # index :: Seq2 a -> Int -> a Source # get the element with index i, counting from the left and starting at 0. O(log(min(i,n-i))) adjust :: (a -> a) -> Int -> Seq2 a -> Seq2 a Source # partition :: (a -> Bool) -> Seq2 a -> (Seq a, Seq a) Source # (<|) :: a -> Seq2 a -> Seq2 a Source # (|>) :: Seq2 a -> a -> Seq2 a Source # (><) :: Seq2 a -> Seq2 a -> Seq2 a Source # Concatenate two sequences. O(log(min(n1,n2))) fromList :: [a] -> Seq2 a Source # pre: the list contains at least two elements mapWithIndex :: (Int -> a -> b) -> Seq2 a -> Seq2 b Source # fmap but with an index take :: Int -> Seq2 a -> Seq a Source # drop :: Int -> Seq2 a -> Seq a Source # toSeq :: Seq2 a -> Seq a Source # fromSeqUnsafe :: Seq a -> Seq2 a Source # Convert a Seq into a Seq2. It is not checked that the length is at least two data ViewL2 a Source # Left views Constructors  a :<< (ViewR1 a) Instances  Source # Instance detailsDefined in Data.Seq2 Methodsfmap :: (a -> b) -> ViewL2 a -> ViewL2 b #(<$) :: a -> ViewL2 b -> ViewL2 a # Source # Instance detailsDefined in Data.Seq2 Methodsfold :: Monoid m => ViewL2 m -> m #foldMap :: Monoid m => (a -> m) -> ViewL2 a -> m #foldr :: (a -> b -> b) -> b -> ViewL2 a -> b #foldr' :: (a -> b -> b) -> b -> ViewL2 a -> b #foldl :: (b -> a -> b) -> b -> ViewL2 a -> b #foldl' :: (b -> a -> b) -> b -> ViewL2 a -> b #foldr1 :: (a -> a -> a) -> ViewL2 a -> a #foldl1 :: (a -> a -> a) -> ViewL2 a -> a #toList :: ViewL2 a -> [a] #null :: ViewL2 a -> Bool #length :: ViewL2 a -> Int #elem :: Eq a => a -> ViewL2 a -> Bool #maximum :: Ord a => ViewL2 a -> a #minimum :: Ord a => ViewL2 a -> a #sum :: Num a => ViewL2 a -> a #product :: Num a => ViewL2 a -> a # Source # At least two elements Instance detailsDefined in Data.Seq2 Methodstraverse :: Applicative f => (a -> f b) -> ViewL2 a -> f (ViewL2 b) #sequenceA :: Applicative f => ViewL2 (f a) -> f (ViewL2 a) #mapM :: Monad m => (a -> m b) -> ViewL2 a -> m (ViewL2 b) #sequence :: Monad m => ViewL2 (m a) -> m (ViewL2 a) # Eq a => Eq (ViewL2 a) Source # Instance detailsDefined in Data.Seq2 Methods(==) :: ViewL2 a -> ViewL2 a -> Bool #(/=) :: ViewL2 a -> ViewL2 a -> Bool # Ord a => Ord (ViewL2 a) Source # Instance detailsDefined in Data.Seq2 Methodscompare :: ViewL2 a -> ViewL2 a -> Ordering #(<) :: ViewL2 a -> ViewL2 a -> Bool #(<=) :: ViewL2 a -> ViewL2 a -> Bool #(>) :: ViewL2 a -> ViewL2 a -> Bool #(>=) :: ViewL2 a -> ViewL2 a -> Bool #max :: ViewL2 a -> ViewL2 a -> ViewL2 a #min :: ViewL2 a -> ViewL2 a -> ViewL2 a # Show a => Show (ViewL2 a) Source # Instance detailsDefined in Data.Seq2 MethodsshowsPrec :: Int -> ViewL2 a -> ShowS #show :: ViewL2 a -> String #showList :: [ViewL2 a] -> ShowS #

data ViewL1 a Source #

At least one element

Constructors

 a :< (Seq a)
Instances
 Source # Instance detailsDefined in Data.Seq2 Methodsfmap :: (a -> b) -> ViewL1 a -> ViewL1 b #(<$) :: a -> ViewL1 b -> ViewL1 a # Source # Instance detailsDefined in Data.Seq2 Methodsfold :: Monoid m => ViewL1 m -> m #foldMap :: Monoid m => (a -> m) -> ViewL1 a -> m #foldr :: (a -> b -> b) -> b -> ViewL1 a -> b #foldr' :: (a -> b -> b) -> b -> ViewL1 a -> b #foldl :: (b -> a -> b) -> b -> ViewL1 a -> b #foldl' :: (b -> a -> b) -> b -> ViewL1 a -> b #foldr1 :: (a -> a -> a) -> ViewL1 a -> a #foldl1 :: (a -> a -> a) -> ViewL1 a -> a #toList :: ViewL1 a -> [a] #null :: ViewL1 a -> Bool #length :: ViewL1 a -> Int #elem :: Eq a => a -> ViewL1 a -> Bool #maximum :: Ord a => ViewL1 a -> a #minimum :: Ord a => ViewL1 a -> a #sum :: Num a => ViewL1 a -> a #product :: Num a => ViewL1 a -> a # Source # Instance detailsDefined in Data.Seq2 Methodstraverse :: Applicative f => (a -> f b) -> ViewL1 a -> f (ViewL1 b) #sequenceA :: Applicative f => ViewL1 (f a) -> f (ViewL1 a) #mapM :: Monad m => (a -> m b) -> ViewL1 a -> m (ViewL1 b) #sequence :: Monad m => ViewL1 (m a) -> m (ViewL1 a) # Eq a => Eq (ViewL1 a) Source # Instance detailsDefined in Data.Seq2 Methods(==) :: ViewL1 a -> ViewL1 a -> Bool #(/=) :: ViewL1 a -> ViewL1 a -> Bool # Ord a => Ord (ViewL1 a) Source # Instance detailsDefined in Data.Seq2 Methodscompare :: ViewL1 a -> ViewL1 a -> Ordering #(<) :: ViewL1 a -> ViewL1 a -> Bool #(<=) :: ViewL1 a -> ViewL1 a -> Bool #(>) :: ViewL1 a -> ViewL1 a -> Bool #(>=) :: ViewL1 a -> ViewL1 a -> Bool #max :: ViewL1 a -> ViewL1 a -> ViewL1 a #min :: ViewL1 a -> ViewL1 a -> ViewL1 a # Show a => Show (ViewL1 a) Source # Instance detailsDefined in Data.Seq2 MethodsshowsPrec :: Int -> ViewL1 a -> ShowS #show :: ViewL1 a -> String #showList :: [ViewL1 a] -> ShowS # Source # We throw away information here; namely that the combined list contains two elements. Instance detailsDefined in Data.Seq2 Methods(<>) :: ViewL1 a -> ViewL1 a -> ViewL1 a #sconcat :: NonEmpty (ViewL1 a) -> ViewL1 a #stimes :: Integral b => b -> ViewL1 a -> ViewL1 a # viewl :: Seq2 a -> ViewL2 a Source # O(1) get a left view data ViewR2 a Source # Right views A view of the right end of the seq, with the guarantee that it has at least two elements Constructors  (ViewL1 a) :>> a Instances  Source # Instance detailsDefined in Data.Seq2 Methodsfmap :: (a -> b) -> ViewR2 a -> ViewR2 b #(<$) :: a -> ViewR2 b -> ViewR2 a # Source # Instance detailsDefined in Data.Seq2 Methodsfold :: Monoid m => ViewR2 m -> m #foldMap :: Monoid m => (a -> m) -> ViewR2 a -> m #foldr :: (a -> b -> b) -> b -> ViewR2 a -> b #foldr' :: (a -> b -> b) -> b -> ViewR2 a -> b #foldl :: (b -> a -> b) -> b -> ViewR2 a -> b #foldl' :: (b -> a -> b) -> b -> ViewR2 a -> b #foldr1 :: (a -> a -> a) -> ViewR2 a -> a #foldl1 :: (a -> a -> a) -> ViewR2 a -> a #toList :: ViewR2 a -> [a] #null :: ViewR2 a -> Bool #length :: ViewR2 a -> Int #elem :: Eq a => a -> ViewR2 a -> Bool #maximum :: Ord a => ViewR2 a -> a #minimum :: Ord a => ViewR2 a -> a #sum :: Num a => ViewR2 a -> a #product :: Num a => ViewR2 a -> a # Source # Instance detailsDefined in Data.Seq2 Methodstraverse :: Applicative f => (a -> f b) -> ViewR2 a -> f (ViewR2 b) #sequenceA :: Applicative f => ViewR2 (f a) -> f (ViewR2 a) #mapM :: Monad m => (a -> m b) -> ViewR2 a -> m (ViewR2 b) #sequence :: Monad m => ViewR2 (m a) -> m (ViewR2 a) # Eq a => Eq (ViewR2 a) Source # Instance detailsDefined in Data.Seq2 Methods(==) :: ViewR2 a -> ViewR2 a -> Bool #(/=) :: ViewR2 a -> ViewR2 a -> Bool # Ord a => Ord (ViewR2 a) Source # Instance detailsDefined in Data.Seq2 Methodscompare :: ViewR2 a -> ViewR2 a -> Ordering #(<) :: ViewR2 a -> ViewR2 a -> Bool #(<=) :: ViewR2 a -> ViewR2 a -> Bool #(>) :: ViewR2 a -> ViewR2 a -> Bool #(>=) :: ViewR2 a -> ViewR2 a -> Bool #max :: ViewR2 a -> ViewR2 a -> ViewR2 a #min :: ViewR2 a -> ViewR2 a -> ViewR2 a # Show a => Show (ViewR2 a) Source # Instance detailsDefined in Data.Seq2 MethodsshowsPrec :: Int -> ViewR2 a -> ShowS #show :: ViewR2 a -> String #showList :: [ViewR2 a] -> ShowS #

data ViewR1 a Source #

A view of the right end of the sequence, with the guarantee that it has at least one element.

Constructors

 (Seq a) :> a
Instances
 Source # Instance detailsDefined in Data.Seq2 Methodsfmap :: (a -> b) -> ViewR1 a -> ViewR1 b #(<\$) :: a -> ViewR1 b -> ViewR1 a # Source # Instance detailsDefined in Data.Seq2 Methodsfold :: Monoid m => ViewR1 m -> m #foldMap :: Monoid m => (a -> m) -> ViewR1 a -> m #foldr :: (a -> b -> b) -> b -> ViewR1 a -> b #foldr' :: (a -> b -> b) -> b -> ViewR1 a -> b #foldl :: (b -> a -> b) -> b -> ViewR1 a -> b #foldl' :: (b -> a -> b) -> b -> ViewR1 a -> b #foldr1 :: (a -> a -> a) -> ViewR1 a -> a #foldl1 :: (a -> a -> a) -> ViewR1 a -> a #toList :: ViewR1 a -> [a] #null :: ViewR1 a -> Bool #length :: ViewR1 a -> Int #elem :: Eq a => a -> ViewR1 a -> Bool #maximum :: Ord a => ViewR1 a -> a #minimum :: Ord a => ViewR1 a -> a #sum :: Num a => ViewR1 a -> a #product :: Num a => ViewR1 a -> a # Source # Instance detailsDefined in Data.Seq2 Methodstraverse :: Applicative f => (a -> f b) -> ViewR1 a -> f (ViewR1 b) #sequenceA :: Applicative f => ViewR1 (f a) -> f (ViewR1 a) #mapM :: Monad m => (a -> m b) -> ViewR1 a -> m (ViewR1 b) #sequence :: Monad m => ViewR1 (m a) -> m (ViewR1 a) # Eq a => Eq (ViewR1 a) Source # Instance detailsDefined in Data.Seq2 Methods(==) :: ViewR1 a -> ViewR1 a -> Bool #(/=) :: ViewR1 a -> ViewR1 a -> Bool # Ord a => Ord (ViewR1 a) Source # Instance detailsDefined in Data.Seq2 Methodscompare :: ViewR1 a -> ViewR1 a -> Ordering #(<) :: ViewR1 a -> ViewR1 a -> Bool #(<=) :: ViewR1 a -> ViewR1 a -> Bool #(>) :: ViewR1 a -> ViewR1 a -> Bool #(>=) :: ViewR1 a -> ViewR1 a -> Bool #max :: ViewR1 a -> ViewR1 a -> ViewR1 a #min :: ViewR1 a -> ViewR1 a -> ViewR1 a # Read a => Read (ViewR1 a) Source # Instance detailsDefined in Data.Seq2 MethodsreadsPrec :: Int -> ReadS (ViewR1 a) #readList :: ReadS [ViewR1 a] # Show a => Show (ViewR1 a) Source # Instance detailsDefined in Data.Seq2 MethodsshowsPrec :: Int -> ViewR1 a -> ShowS #show :: ViewR1 a -> String #showList :: [ViewR1 a] -> ShowS #

viewr :: Seq2 a -> ViewR2 a Source #

O(1) get a right view