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

Safe HaskellNone
LanguageHaskell2010

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 

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

(<|) :: 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

data ViewL1 a Source

At least one element

Constructors

a :< (Seq a) 

Instances

Functor ViewL1 Source 
Foldable ViewL1 Source 
Traversable ViewL1 Source 
Eq a => Eq (ViewL1 a) Source 
Ord a => Ord (ViewL1 a) Source 
Read a => Read (ViewL1 a) Source 
Show a => Show (ViewL1 a) Source 
Semigroup (ViewL1 a) Source

We throw away information here; namely that the combined list contains two elements.

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 

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 

viewr :: Seq2 a -> ViewR2 a Source

O(1) get a right view