module Data.Vector (
Vector, MVector,
length, null,
empty, singleton, cons, snoc, replicate, generate, (++), copy,
(!), head, last, indexM, headM, lastM,
unsafeIndex, unsafeHead, unsafeLast,
unsafeIndexM, unsafeHeadM, unsafeLastM,
slice, init, tail, take, drop,
unsafeSlice, unsafeInit, unsafeTail, unsafeTake, unsafeDrop,
accum, accumulate, accumulate_,
(//), update, update_,
backpermute, reverse,
unsafeAccum, unsafeAccumulate, unsafeAccumulate_,
unsafeUpd, unsafeUpdate, unsafeUpdate_,
unsafeBackpermute,
map, imap, concatMap,
zipWith, zipWith3, zipWith4, zipWith5, zipWith6,
izipWith, izipWith3, izipWith4, izipWith5, izipWith6,
zip, zip3, zip4, zip5, zip6,
unzip, unzip3, unzip4, unzip5, unzip6,
filter, ifilter, takeWhile, dropWhile,
partition, unstablePartition, span, break,
elem, notElem, find, findIndex, findIndices, elemIndex, elemIndices,
foldl, foldl1, foldl', foldl1', foldr, foldr1, foldr', foldr1',
ifoldl, ifoldl', ifoldr, ifoldr',
all, any, and, or,
sum, product,
maximum, maximumBy, minimum, minimumBy,
minIndex, minIndexBy, maxIndex, maxIndexBy,
unfoldr,
prescanl, prescanl',
postscanl, postscanl',
scanl, scanl', scanl1, scanl1',
prescanr, prescanr',
postscanr, postscanr',
scanr, scanr', scanr1, scanr1',
enumFromN, enumFromStepN, enumFromTo, enumFromThenTo,
toList, fromList
) where
import qualified Data.Vector.Generic as G
import Data.Vector.Mutable ( MVector(..) )
import Data.Primitive.Array
import Control.Monad ( liftM )
import Prelude hiding ( length, null,
replicate, (++),
head, last,
init, tail, take, drop, reverse,
map, concatMap,
zipWith, zipWith3, zip, zip3, unzip, unzip3,
filter, takeWhile, dropWhile, span, break,
elem, notElem,
foldl, foldl1, foldr, foldr1,
all, any, and, or, sum, product, minimum, maximum,
scanl, scanl1, scanr, scanr1,
enumFromTo, enumFromThenTo )
import qualified Prelude
data Vector a = Vector !Int
!Int
!(Array a)
instance Show a => Show (Vector a) where
show = (Prelude.++ " :: Data.Vector.Vector") . ("fromList " Prelude.++) . show . toList
type instance G.Mutable Vector = MVector
instance G.Vector Vector a where
unsafeFreeze (MVector i n marr)
= Vector i n `liftM` unsafeFreezeArray marr
basicLength (Vector _ n _) = n
basicUnsafeSlice j n (Vector i _ arr) = Vector (i+j) n arr
basicUnsafeIndexM (Vector i _ arr) j = indexArrayM arr (i+j)
instance Eq a => Eq (Vector a) where
(==) = G.eq
instance Ord a => Ord (Vector a) where
compare = G.cmp
length :: Vector a -> Int
length = G.length
null :: Vector a -> Bool
null = G.null
empty :: Vector a
empty = G.empty
singleton :: a -> Vector a
singleton = G.singleton
replicate :: Int -> a -> Vector a
replicate = G.replicate
generate :: Int -> (Int -> a) -> Vector a
generate = G.generate
cons :: a -> Vector a -> Vector a
cons = G.cons
snoc :: Vector a -> a -> Vector a
snoc = G.snoc
infixr 5 ++
(++) :: Vector a -> Vector a -> Vector a
(++) = (G.++)
copy :: Vector a -> Vector a
copy = G.copy
(!) :: Vector a -> Int -> a
(!) = (G.!)
head :: Vector a -> a
head = G.head
last :: Vector a -> a
last = G.last
unsafeIndex :: Vector a -> Int -> a
unsafeIndex = G.unsafeIndex
unsafeHead :: Vector a -> a
unsafeHead = G.unsafeHead
unsafeLast :: Vector a -> a
unsafeLast = G.unsafeLast
indexM :: Monad m => Vector a -> Int -> m a
indexM = G.indexM
headM :: Monad m => Vector a -> m a
headM = G.headM
lastM :: Monad m => Vector a -> m a
lastM = G.lastM
unsafeIndexM :: Monad m => Vector a -> Int -> m a
unsafeIndexM = G.unsafeIndexM
unsafeHeadM :: Monad m => Vector a -> m a
unsafeHeadM = G.unsafeHeadM
unsafeLastM :: Monad m => Vector a -> m a
unsafeLastM = G.unsafeLastM
slice :: Int
-> Int
-> Vector a
-> Vector a
slice = G.slice
init :: Vector a -> Vector a
init = G.init
tail :: Vector a -> Vector a
tail = G.tail
take :: Int -> Vector a -> Vector a
take = G.take
drop :: Int -> Vector a -> Vector a
drop = G.drop
unsafeSlice :: Int
-> Int
-> Vector a
-> Vector a
unsafeSlice = G.unsafeSlice
unsafeInit :: Vector a -> Vector a
unsafeInit = G.unsafeInit
unsafeTail :: Vector a -> Vector a
unsafeTail = G.unsafeTail
unsafeTake :: Int -> Vector a -> Vector a
unsafeTake = G.unsafeTake
unsafeDrop :: Int -> Vector a -> Vector a
unsafeDrop = G.unsafeDrop
unsafeAccum :: (a -> b -> a) -> Vector a -> [(Int,b)] -> Vector a
unsafeAccum = G.unsafeAccum
unsafeAccumulate :: (a -> b -> a) -> Vector a -> Vector (Int,b) -> Vector a
unsafeAccumulate = G.unsafeAccumulate
unsafeAccumulate_
:: (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a
unsafeAccumulate_ = G.unsafeAccumulate_
accum :: (a -> b -> a) -> Vector a -> [(Int,b)] -> Vector a
accum = G.accum
accumulate :: (a -> b -> a) -> Vector a -> Vector (Int,b) -> Vector a
accumulate = G.accumulate
accumulate_ :: (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a
accumulate_ = G.accumulate_
unsafeUpd :: Vector a -> [(Int, a)] -> Vector a
unsafeUpd = G.unsafeUpd
unsafeUpdate :: Vector a -> Vector (Int, a) -> Vector a
unsafeUpdate = G.unsafeUpdate
unsafeUpdate_ :: Vector a -> Vector Int -> Vector a -> Vector a
unsafeUpdate_ = G.unsafeUpdate_
(//) :: Vector a -> [(Int, a)] -> Vector a
(//) = (G.//)
update :: Vector a -> Vector (Int, a) -> Vector a
update = G.update
update_ :: Vector a -> Vector Int -> Vector a -> Vector a
update_ = G.update_
backpermute :: Vector a -> Vector Int -> Vector a
backpermute = G.backpermute
unsafeBackpermute :: Vector a -> Vector Int -> Vector a
unsafeBackpermute = G.unsafeBackpermute
reverse :: Vector a -> Vector a
reverse = G.reverse
map :: (a -> b) -> Vector a -> Vector b
map = G.map
imap :: (Int -> a -> b) -> Vector a -> Vector b
imap = G.imap
concatMap :: (a -> Vector b) -> Vector a -> Vector b
concatMap = G.concatMap
zipWith :: (a -> b -> c) -> Vector a -> Vector b -> Vector c
zipWith = G.zipWith
zipWith3 :: (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
zipWith3 = G.zipWith3
zipWith4 :: (a -> b -> c -> d -> e)
-> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
zipWith4 = G.zipWith4
zipWith5 :: (a -> b -> c -> d -> e -> f)
-> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
-> Vector f
zipWith5 = G.zipWith5
zipWith6 :: (a -> b -> c -> d -> e -> f -> g)
-> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
-> Vector f -> Vector g
zipWith6 = G.zipWith6
izipWith :: (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c
izipWith = G.izipWith
izipWith3 :: (Int -> a -> b -> c -> d)
-> Vector a -> Vector b -> Vector c -> Vector d
izipWith3 = G.izipWith3
izipWith4 :: (Int -> a -> b -> c -> d -> e)
-> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
izipWith4 = G.izipWith4
izipWith5 :: (Int -> a -> b -> c -> d -> e -> f)
-> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
-> Vector f
izipWith5 = G.izipWith5
izipWith6 :: (Int -> a -> b -> c -> d -> e -> f -> g)
-> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
-> Vector f -> Vector g
izipWith6 = G.izipWith6
zip :: Vector a -> Vector b -> Vector (a, b)
zip = G.zip
zip3 :: Vector a -> Vector b -> Vector c -> Vector (a, b, c)
zip3 = G.zip3
zip4 :: Vector a -> Vector b -> Vector c -> Vector d
-> Vector (a, b, c, d)
zip4 = G.zip4
zip5 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e
-> Vector (a, b, c, d, e)
zip5 = G.zip5
zip6 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
-> Vector (a, b, c, d, e, f)
zip6 = G.zip6
unzip :: Vector (a, b) -> (Vector a, Vector b)
unzip = G.unzip
unzip3 :: Vector (a, b, c) -> (Vector a, Vector b, Vector c)
unzip3 = G.unzip3
unzip4 :: Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)
unzip4 = G.unzip4
unzip5 :: Vector (a, b, c, d, e)
-> (Vector a, Vector b, Vector c, Vector d, Vector e)
unzip5 = G.unzip5
unzip6 :: Vector (a, b, c, d, e, f)
-> (Vector a, Vector b, Vector c, Vector d, Vector e, Vector f)
unzip6 = G.unzip6
filter :: (a -> Bool) -> Vector a -> Vector a
filter = G.filter
ifilter :: (Int -> a -> Bool) -> Vector a -> Vector a
ifilter = G.ifilter
takeWhile :: (a -> Bool) -> Vector a -> Vector a
takeWhile = G.takeWhile
dropWhile :: (a -> Bool) -> Vector a -> Vector a
dropWhile = G.dropWhile
partition :: (a -> Bool) -> Vector a -> (Vector a, Vector a)
partition = G.partition
unstablePartition :: (a -> Bool) -> Vector a -> (Vector a, Vector a)
unstablePartition = G.unstablePartition
span :: (a -> Bool) -> Vector a -> (Vector a, Vector a)
span = G.span
break :: (a -> Bool) -> Vector a -> (Vector a, Vector a)
break = G.break
infix 4 `elem`
elem :: Eq a => a -> Vector a -> Bool
elem = G.elem
infix 4 `notElem`
notElem :: Eq a => a -> Vector a -> Bool
notElem = G.notElem
find :: (a -> Bool) -> Vector a -> Maybe a
find = G.find
findIndex :: (a -> Bool) -> Vector a -> Maybe Int
findIndex = G.findIndex
findIndices :: (a -> Bool) -> Vector a -> Vector Int
findIndices = G.findIndices
elemIndex :: Eq a => a -> Vector a -> Maybe Int
elemIndex = G.elemIndex
elemIndices :: Eq a => a -> Vector a -> Vector Int
elemIndices = G.elemIndices
foldl :: (a -> b -> a) -> a -> Vector b -> a
foldl = G.foldl
foldl1 :: (a -> a -> a) -> Vector a -> a
foldl1 = G.foldl1
foldl' :: (a -> b -> a) -> a -> Vector b -> a
foldl' = G.foldl'
foldl1' :: (a -> a -> a) -> Vector a -> a
foldl1' = G.foldl1'
foldr :: (a -> b -> b) -> b -> Vector a -> b
foldr = G.foldr
foldr1 :: (a -> a -> a) -> Vector a -> a
foldr1 = G.foldr1
foldr' :: (a -> b -> b) -> b -> Vector a -> b
foldr' = G.foldr'
foldr1' :: (a -> a -> a) -> Vector a -> a
foldr1' = G.foldr1'
ifoldl :: (a -> Int -> b -> a) -> a -> Vector b -> a
ifoldl = G.ifoldl
ifoldl' :: (a -> Int -> b -> a) -> a -> Vector b -> a
ifoldl' = G.ifoldl'
ifoldr :: (Int -> a -> b -> b) -> b -> Vector a -> b
ifoldr = G.ifoldr
ifoldr' :: (Int -> a -> b -> b) -> b -> Vector a -> b
ifoldr' = G.ifoldr'
all :: (a -> Bool) -> Vector a -> Bool
all = G.all
any :: (a -> Bool) -> Vector a -> Bool
any = G.any
and :: Vector Bool -> Bool
and = G.and
or :: Vector Bool -> Bool
or = G.or
sum :: Num a => Vector a -> a
sum = G.sum
product :: Num a => Vector a -> a
product = G.product
maximum :: Ord a => Vector a -> a
maximum = G.maximum
maximumBy :: (a -> a -> Ordering) -> Vector a -> a
maximumBy = G.maximumBy
minimum :: Ord a => Vector a -> a
minimum = G.minimum
minimumBy :: (a -> a -> Ordering) -> Vector a -> a
minimumBy = G.minimumBy
maxIndex :: Ord a => Vector a -> Int
maxIndex = G.maxIndex
maxIndexBy :: (a -> a -> Ordering) -> Vector a -> Int
maxIndexBy = G.maxIndexBy
minIndex :: Ord a => Vector a -> Int
minIndex = G.minIndex
minIndexBy :: (a -> a -> Ordering) -> Vector a -> Int
minIndexBy = G.minIndexBy
unfoldr :: (b -> Maybe (a, b)) -> b -> Vector a
unfoldr = G.unfoldr
prescanl :: (a -> b -> a) -> a -> Vector b -> Vector a
prescanl = G.prescanl
prescanl' :: (a -> b -> a) -> a -> Vector b -> Vector a
prescanl' = G.prescanl'
postscanl :: (a -> b -> a) -> a -> Vector b -> Vector a
postscanl = G.postscanl
postscanl' :: (a -> b -> a) -> a -> Vector b -> Vector a
postscanl' = G.postscanl'
scanl :: (a -> b -> a) -> a -> Vector b -> Vector a
scanl = G.scanl
scanl' :: (a -> b -> a) -> a -> Vector b -> Vector a
scanl' = G.scanl'
scanl1 :: (a -> a -> a) -> Vector a -> Vector a
scanl1 = G.scanl1
scanl1' :: (a -> a -> a) -> Vector a -> Vector a
scanl1' = G.scanl1'
prescanr :: (a -> b -> b) -> b -> Vector a -> Vector b
prescanr = G.prescanr
prescanr' :: (a -> b -> b) -> b -> Vector a -> Vector b
prescanr' = G.prescanr'
postscanr :: (a -> b -> b) -> b -> Vector a -> Vector b
postscanr = G.postscanr
postscanr' :: (a -> b -> b) -> b -> Vector a -> Vector b
postscanr' = G.postscanr'
scanr :: (a -> b -> b) -> b -> Vector a -> Vector b
scanr = G.scanr
scanr' :: (a -> b -> b) -> b -> Vector a -> Vector b
scanr' = G.scanr'
scanr1 :: (a -> a -> a) -> Vector a -> Vector a
scanr1 = G.scanr1
scanr1' :: (a -> a -> a) -> Vector a -> Vector a
scanr1' = G.scanr1'
enumFromN :: Num a => a -> Int -> Vector a
enumFromN = G.enumFromN
enumFromStepN :: Num a => a -> a -> Int -> Vector a
enumFromStepN = G.enumFromStepN
enumFromTo :: Enum a => a -> a -> Vector a
enumFromTo = G.enumFromTo
enumFromThenTo :: Enum a => a -> a -> a -> Vector a
enumFromThenTo = G.enumFromThenTo
toList :: Vector a -> [a]
toList = G.toList
fromList :: [a] -> Vector a
fromList = G.fromList