vector-text-1.1.6: Text implementation based on unboxed char vector.

Safe HaskellNone
LanguageHaskell2010

Data.Container.Vector

Contents

Synopsis

Documentation

alloc :: Vector v a => Int -> v a Source #

O(1)

replicate' :: Vector v a => Int -> v a -> v a Source #

O(n)

index :: Vector v a => v a -> Int -> Maybe a Source #

O(1)

(!) :: Vector v a => v a -> Int -> Maybe a infixl 9 Source #

O(1)

(!!) :: Vector v a => v a -> Int -> a infixl 9 Source #

O(1)

head :: Vector v a => v a -> Maybe a Source #

O(1)

last :: Vector v a => v a -> Maybe a Source #

O(1)

init :: Vector v a => v a -> Maybe (v a) Source #

O(1)

tail :: Vector v a => v a -> Maybe (v a) Source #

O(1)

splitHead :: Vector v a => v a -> Maybe (a, v a) Source #

O(1)

splitLast :: Vector v a => v a -> Maybe (a, v a) Source #

O(1)

unsafeSplitHead :: Vector v a => v a -> (a, v a) Source #

O(1)

unsafeSplitLast :: Vector v a => v a -> (a, v a) Source #

O(1)

takeTill :: Vector v a => (a -> Bool) -> v a -> v a Source #

O(s)

takeWhile :: Vector v a => (a -> Bool) -> v a -> v a Source #

O(s)

takeWhileStream :: Vector v a => (a -> Bool) -> v a -> v a Source #

O(s) Just like takeWhile, but uses streaming instead of slicing.

dropWhileStream :: Vector v a => (a -> Bool) -> v a -> v a Source #

O(s)

breakAll :: Vector v a => (a -> Bool) -> v a -> [v a] Source #

O(n)

replaceUsing :: Vector v a => (a -> Bool) -> (a -> v a) -> v a -> v a Source #

O(n)

replace :: (Vector v a, Eq a) => a -> v a -> v a -> v a Source #

O(n)

commonPrefixes :: (Vector v a, Eq a) => v a -> v a -> Maybe (v a, v a, v a) Source #

span :: Vector v a => (a -> Bool) -> v a -> (v a, v a) #

O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.

concatMap :: (Vector v a, Vector v b) => (a -> v b) -> v a -> v b #

Map a function over a vector and concatenate the results.

imap :: (Vector v a, Vector v b) => (Int -> a -> b) -> v a -> v b #

O(n) Apply a function to every element of a vector and its index

map :: (Vector v a, Vector v b) => (a -> b) -> v a -> v b #

O(n) Map a function over a vector

concat :: Vector v a => [v a] -> v a #

O(n) Concatenate all vectors in the list

snoc :: Vector v a => v a -> a -> v a #

O(n) Append an element

cons :: Vector v a => a -> v a -> v a #

O(n) Prepend an element

singleton :: Vector v a => a -> v a #

O(1) Vector with exactly one element

unsafeDrop :: Vector v a => Int -> v a -> v a #

O(1) Yield all but the first n elements without copying. The vector must contain at least n elements but this is not checked.

unsafeTake :: Vector v a => Int -> v a -> v a #

O(1) Yield the first n elements without copying. The vector must contain at least n elements but this is not checked.

unsafeTail :: Vector v a => v a -> v a #

O(1) Yield all but the first element without copying. The vector may not be empty but this is not checked.

unsafeInit :: Vector v a => v a -> v a #

O(1) Yield all but the last element without copying. The vector may not be empty but this is not checked.

unsafeSlice #

Arguments

:: Vector v a 
=> Int

i starting index

-> Int

n length

-> v a 
-> v a 

O(1) Yield a slice of the vector without copying. The vector must contain at least i+n elements but this is not checked.

splitAt :: Vector v a => Int -> v a -> (v a, v a) #

O(1) Yield the first n elements paired with the remainder without copying.

Note that splitAt n v is equivalent to (take n v, drop n v) but slightly more efficient.

unsafeLast :: Vector v a => v a -> a #

O(1) Last element without checking if the vector is empty

unsafeHead :: Vector v a => v a -> a #

O(1) First element without checking if the vector is empty

unsafeIndex :: Vector v a => v a -> Int -> a #

O(1) Unsafe indexing without bounds checking

null :: Vector v a => v a -> Bool #

O(1) Test whether a vector is empty

length :: Vector v a => v a -> Int #

O(1) Yield the length of the vector

Orphan instances

(Vector Vector a, Convertible' Char a) => Convertible Char (Vector a) Source # 
Instance details

Methods

convert :: Char -> Vector a #

(Vector Vector a, Convertible' Char a) => Convertible Text (Vector a) Source # 
Instance details

Methods

convert :: Text -> Vector a #

(Vector Vector a, Convertible' Char a) => IsString (Vector a) Source # 
Instance details

Methods

fromString :: String -> Vector a #

(Vector Vector a, Convertible' a Char) => Convertible (Vector a) Text Source # 
Instance details

Methods

convert :: Vector a -> Text #

Vector Vector a => Convertible [a] (Vector a) Source # 
Instance details

Methods

convert :: [a] -> Vector a #

(Vector Vector a, Convertible' t a) => Convertible [t] (Vector a) Source #

We cannot use automatic Convertible1 -> Convertible lifting, because converting unboxed Vectors constraints a to be unboxed as well.

Instance details

Methods

convert :: [t] -> Vector a #

Vector Vector a => Convertible (Vector a) [a] Source # 
Instance details

Methods

convert :: Vector a -> [a] #

(Vector Vector a, Convertible' a t) => Convertible (Vector a) [t] Source # 
Instance details

Methods

convert :: Vector a -> [t] #