Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module reexports the functionality in Generic
which maps well
to explicity sized vectors.
Functions returning a vector determine the size from the type context unless
they have a '
suffix in which case they take an explicit Proxy
argument.
Functions where the resultant vector size is not know until compile time are not exported.
Synopsis
- data Vector v (n :: Nat) a where
- data MVector v (n :: Nat) s a
- length :: forall v n a. KnownNat n => Vector v n a -> Int
- length' :: forall v n a. Vector v n a -> Proxy n
- knownLength :: forall v n a r. Vector v a => Vector v n a -> (KnownNat n => r) -> r
- knownLength' :: forall v n a r. Vector v a => Vector v n a -> (KnownNat n => Proxy n -> r) -> r
- index :: forall v n a. Vector v a => Vector v n a -> Finite n -> a
- index' :: forall v n m a p. (KnownNat n, Vector v a) => Vector v ((n + m) + 1) a -> p n -> a
- unsafeIndex :: forall v n a. Vector v a => Vector v n a -> Int -> a
- head :: forall v n a. Vector v a => Vector v (1 + n) a -> a
- last :: forall v n a. Vector v a => Vector v (n + 1) a -> a
- indexM :: forall v n a m. (Vector v a, Monad m) => Vector v n a -> Finite n -> m a
- indexM' :: forall v n k a m p. (KnownNat n, Vector v a, Monad m) => Vector v (n + k) a -> p n -> m a
- unsafeIndexM :: forall v n a m. (Vector v a, Monad m) => Vector v n a -> Int -> m a
- headM :: forall v n a m. (Vector v a, Monad m) => Vector v (1 + n) a -> m a
- lastM :: forall v n a m. (Vector v a, Monad m) => Vector v (n + 1) a -> m a
- slice :: forall v i n m a p. (KnownNat i, KnownNat n, Vector v a) => p i -> Vector v ((i + n) + m) a -> Vector v n a
- slice' :: forall v i n m a p. (KnownNat i, KnownNat n, Vector v a) => p i -> p n -> Vector v ((i + n) + m) a -> Vector v n a
- init :: forall v n a. Vector v a => Vector v (n + 1) a -> Vector v n a
- tail :: forall v n a. Vector v a => Vector v (1 + n) a -> Vector v n a
- take :: forall v n m a. (KnownNat n, Vector v a) => Vector v (n + m) a -> Vector v n a
- take' :: forall v n m a p. (KnownNat n, Vector v a) => p n -> Vector v (n + m) a -> Vector v n a
- drop :: forall v n m a. (KnownNat n, Vector v a) => Vector v (n + m) a -> Vector v m a
- drop' :: forall v n m a p. (KnownNat n, Vector v a) => p n -> Vector v (n + m) a -> Vector v m a
- splitAt :: forall v n m a. (KnownNat n, Vector v a) => Vector v (n + m) a -> (Vector v n a, Vector v m a)
- splitAt' :: forall v n m a p. (KnownNat n, Vector v a) => p n -> Vector v (n + m) a -> (Vector v n a, Vector v m a)
- empty :: forall v a. Vector v a => Vector v 0 a
- singleton :: forall v a. Vector v a => a -> Vector v 1 a
- fromTuple :: forall v a input length. (Vector v a, IndexedListLiterals input length a, KnownNat length) => input -> Vector v length a
- replicate :: forall v n a. (KnownNat n, Vector v a) => a -> Vector v n a
- replicate' :: forall v n a p. (KnownNat n, Vector v a) => p n -> a -> Vector v n a
- generate :: forall v n a. (KnownNat n, Vector v a) => (Finite n -> a) -> Vector v n a
- generate' :: forall v n a p. (KnownNat n, Vector v a) => p n -> (Finite n -> a) -> Vector v n a
- iterateN :: forall v n a. (KnownNat n, Vector v a) => (a -> a) -> a -> Vector v n a
- iterateN' :: forall v n a p. (KnownNat n, Vector v a) => p n -> (a -> a) -> a -> Vector v n a
- replicateM :: forall v n m a. (KnownNat n, Vector v a, Monad m) => m a -> m (Vector v n a)
- replicateM' :: forall v n m a p. (KnownNat n, Vector v a, Monad m) => p n -> m a -> m (Vector v n a)
- generateM :: forall v n m a. (KnownNat n, Vector v a, Monad m) => (Finite n -> m a) -> m (Vector v n a)
- generateM' :: forall v n m a p. (KnownNat n, Vector v a, Monad m) => p n -> (Finite n -> m a) -> m (Vector v n a)
- unfoldrN :: forall v n a b. (KnownNat n, Vector v a) => (b -> (a, b)) -> b -> Vector v n a
- unfoldrN' :: forall v n a b p. (KnownNat n, Vector v a) => p n -> (b -> (a, b)) -> b -> Vector v n a
- enumFromN :: forall v n a. (KnownNat n, Vector v a, Num a) => a -> Vector v n a
- enumFromN' :: forall v n a p. (KnownNat n, Vector v a, Num a) => a -> p n -> Vector v n a
- enumFromStepN :: forall v n a. (KnownNat n, Vector v a, Num a) => a -> a -> Vector v n a
- enumFromStepN' :: forall v n a p. (KnownNat n, Vector v a, Num a) => a -> a -> p n -> Vector v n a
- cons :: forall v n a. Vector v a => a -> Vector v n a -> Vector v (1 + n) a
- snoc :: forall v n a. Vector v a => Vector v n a -> a -> Vector v (n + 1) a
- (++) :: forall v n m a. Vector v a => Vector v n a -> Vector v m a -> Vector v (n + m) a
- force :: Vector v a => Vector v n a -> Vector v n a
- (//) :: Vector v a => Vector v m a -> [(Finite m, a)] -> Vector v m a
- update :: (Vector v a, Vector v (Int, a)) => Vector v m a -> Vector v n (Int, a) -> Vector v m a
- update_ :: (Vector v a, Vector v Int) => Vector v m a -> Vector v n Int -> Vector v n a -> Vector v m a
- unsafeUpd :: Vector v a => Vector v m a -> [(Int, a)] -> Vector v m a
- unsafeUpdate :: (Vector v a, Vector v (Int, a)) => Vector v m a -> Vector v n (Int, a) -> Vector v m a
- unsafeUpdate_ :: (Vector v a, Vector v Int) => Vector v m a -> Vector v n Int -> Vector v n a -> Vector v m a
- accum :: Vector v a => (a -> b -> a) -> Vector v m a -> [(Int, b)] -> Vector v m a
- accumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> Vector v m a -> Vector v n (Int, b) -> Vector v m a
- accumulate_ :: (Vector v a, Vector v Int, Vector v b) => (a -> b -> a) -> Vector v m a -> Vector v n Int -> Vector v n b -> Vector v m a
- unsafeAccum :: Vector v a => (a -> b -> a) -> Vector v m a -> [(Int, b)] -> Vector v m a
- unsafeAccumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> Vector v m a -> Vector v n (Int, b) -> Vector v m a
- unsafeAccumulate_ :: (Vector v a, Vector v Int, Vector v b) => (a -> b -> a) -> Vector v m a -> Vector v n Int -> Vector v n b -> Vector v m a
- reverse :: Vector v a => Vector v n a -> Vector v n a
- backpermute :: (Vector v a, Vector v Int) => Vector v m a -> Vector v n Int -> Vector v n a
- unsafeBackpermute :: (Vector v a, Vector v Int) => Vector v m a -> Vector v n Int -> Vector v n a
- ix :: forall v n a f. (Vector v a, Functor f) => Finite n -> (a -> f a) -> Vector v n a -> f (Vector v n a)
- _head :: forall v n a f. (Vector v a, Functor f) => (a -> f a) -> Vector v (1 + n) a -> f (Vector v (1 + n) a)
- _last :: forall v n a f. (Vector v a, Functor f) => (a -> f a) -> Vector v (n + 1) a -> f (Vector v (n + 1) a)
- indexed :: (Vector v a, Vector v (Int, a), Vector v (Finite n, a)) => Vector v n a -> Vector v n (Finite n, a)
- map :: (Vector v a, Vector v b) => (a -> b) -> Vector v n a -> Vector v n b
- imap :: (Vector v a, Vector v b) => (Finite n -> a -> b) -> Vector v n a -> Vector v n b
- concatMap :: (Vector v a, Vector v' b) => (a -> Vector v' m b) -> Vector v n a -> Vector v' (n * m) b
- mapM :: (Monad m, Vector v a, Vector v b) => (a -> m b) -> Vector v n a -> m (Vector v n b)
- imapM :: (Monad m, Vector v a, Vector v b) => (Finite n -> a -> m b) -> Vector v n a -> m (Vector v n b)
- mapM_ :: (Monad m, Vector v a) => (a -> m b) -> Vector v n a -> m ()
- imapM_ :: (Monad m, Vector v a) => (Finite n -> a -> m b) -> Vector v n a -> m ()
- forM :: (Monad m, Vector v a, Vector v b) => Vector v n a -> (a -> m b) -> m (Vector v n b)
- forM_ :: (Monad m, Vector v a) => Vector v n a -> (a -> m b) -> m ()
- zipWith :: (Vector v a, Vector v b, Vector v c) => (a -> b -> c) -> Vector v n a -> Vector v n b -> Vector v n c
- zipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (a -> b -> c -> d) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d
- zipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (a -> b -> c -> d -> e) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e
- zipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (a -> b -> c -> d -> e -> f) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f
- zipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (a -> b -> c -> d -> e -> f -> g) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f -> Vector v n g
- izipWith :: (Vector v a, Vector v b, Vector v c) => (Finite n -> a -> b -> c) -> Vector v n a -> Vector v n b -> Vector v n c
- izipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (Finite n -> a -> b -> c -> d) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d
- izipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (Finite n -> a -> b -> c -> d -> e) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e
- izipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (Finite n -> a -> b -> c -> d -> e -> f) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f
- izipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (Finite n -> a -> b -> c -> d -> e -> f -> g) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f -> Vector v n g
- zip :: (Vector v a, Vector v b, Vector v (a, b)) => Vector v n a -> Vector v n b -> Vector v n (a, b)
- zip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => Vector v n a -> Vector v n b -> Vector v n c -> Vector v n (a, b, c)
- zip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n (a, b, c, d)
- zip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n (a, b, c, d, e)
- zip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f -> Vector v n (a, b, c, d, e, f)
- zipWithM :: (Monad m, Vector v a, Vector v b, Vector v c) => (a -> b -> m c) -> Vector v n a -> Vector v n b -> m (Vector v n c)
- izipWithM :: (Monad m, Vector v a, Vector v b, Vector v c) => (Finite n -> a -> b -> m c) -> Vector v n a -> Vector v n b -> m (Vector v n c)
- zipWithM_ :: (Monad m, Vector v a, Vector v b) => (a -> b -> m c) -> Vector v n a -> Vector v n b -> m ()
- izipWithM_ :: (Monad m, Vector v a, Vector v b) => (Finite n -> a -> b -> m c) -> Vector v n a -> Vector v n b -> m ()
- unzip :: (Vector v a, Vector v b, Vector v (a, b)) => Vector v n (a, b) -> (Vector v n a, Vector v n b)
- unzip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => Vector v n (a, b, c) -> (Vector v n a, Vector v n b, Vector v n c)
- unzip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => Vector v n (a, b, c, d) -> (Vector v n a, Vector v n b, Vector v n c, Vector v n d)
- unzip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => Vector v n (a, b, c, d, e) -> (Vector v n a, Vector v n b, Vector v n c, Vector v n d, Vector v n e)
- unzip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => Vector v n (a, b, c, d, e, f) -> (Vector v n a, Vector v n b, Vector v n c, Vector v n d, Vector v n e, Vector v n f)
- elem :: (Vector v a, Eq a) => a -> Vector v n a -> Bool
- notElem :: (Vector v a, Eq a) => a -> Vector v n a -> Bool
- find :: Vector v a => (a -> Bool) -> Vector v n a -> Maybe a
- findIndex :: Vector v a => (a -> Bool) -> Vector v n a -> Maybe (Finite n)
- elemIndex :: (Vector v a, Eq a) => a -> Vector v n a -> Maybe (Finite n)
- foldl :: Vector v b => (a -> b -> a) -> a -> Vector v n b -> a
- foldl1 :: Vector v a => (a -> a -> a) -> Vector v (1 + n) a -> a
- foldl' :: Vector v b => (a -> b -> a) -> a -> Vector v n b -> a
- foldl1' :: Vector v a => (a -> a -> a) -> Vector v (1 + n) a -> a
- foldr :: Vector v a => (a -> b -> b) -> b -> Vector v n a -> b
- foldr1 :: Vector v a => (a -> a -> a) -> Vector v (n + 1) a -> a
- foldr' :: Vector v a => (a -> b -> b) -> b -> Vector v n a -> b
- foldr1' :: Vector v a => (a -> a -> a) -> Vector v (n + 1) a -> a
- ifoldl :: Vector v b => (a -> Finite n -> b -> a) -> a -> Vector v n b -> a
- ifoldl' :: Vector v b => (a -> Finite n -> b -> a) -> a -> Vector v n b -> a
- ifoldr :: Vector v a => (Finite n -> a -> b -> b) -> b -> Vector v n a -> b
- ifoldr' :: Vector v a => (Finite n -> a -> b -> b) -> b -> Vector v n a -> b
- all :: Vector v a => (a -> Bool) -> Vector v n a -> Bool
- any :: Vector v a => (a -> Bool) -> Vector v n a -> Bool
- and :: Vector v Bool => Vector v n Bool -> Bool
- or :: Vector v Bool => Vector v n Bool -> Bool
- sum :: (Vector v a, Num a) => Vector v n a -> a
- product :: (Vector v a, Num a) => Vector v n a -> a
- maximum :: (Vector v a, Ord a) => Vector v (n + 1) a -> a
- maximumBy :: Vector v a => (a -> a -> Ordering) -> Vector v (n + 1) a -> a
- minimum :: (Vector v a, Ord a) => Vector v (n + 1) a -> a
- minimumBy :: Vector v a => (a -> a -> Ordering) -> Vector v (n + 1) a -> a
- maxIndex :: (Vector v a, Ord a) => Vector v (n + 1) a -> Finite (n + 1)
- maxIndexBy :: Vector v a => (a -> a -> Ordering) -> Vector v (n + 1) a -> Finite (n + 1)
- minIndex :: (Vector v a, Ord a) => Vector v (n + 1) a -> Finite (n + 1)
- minIndexBy :: Vector v a => (a -> a -> Ordering) -> Vector v (n + 1) a -> Finite (n + 1)
- foldM :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m a
- ifoldM :: (Monad m, Vector v b) => (a -> Finite n -> b -> m a) -> a -> Vector v n b -> m a
- fold1M :: (Monad m, Vector v a) => (a -> a -> m a) -> Vector v (1 + n) a -> m a
- foldM' :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m a
- ifoldM' :: (Monad m, Vector v b) => (a -> Finite n -> b -> m a) -> a -> Vector v n b -> m a
- fold1M' :: (Monad m, Vector v a) => (a -> a -> m a) -> Vector v (n + 1) a -> m a
- foldM_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m ()
- ifoldM_ :: (Monad m, Vector v b) => (a -> Finite n -> b -> m a) -> a -> Vector v n b -> m ()
- fold1M_ :: (Monad m, Vector v a) => (a -> a -> m a) -> Vector v (n + 1) a -> m ()
- foldM'_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m ()
- ifoldM'_ :: (Monad m, Vector v b) => (a -> Finite n -> b -> m a) -> a -> Vector v n b -> m ()
- fold1M'_ :: (Monad m, Vector v a) => (a -> a -> m a) -> Vector v (n + 1) a -> m ()
- sequence :: (Monad m, Vector v a, Vector v (m a)) => Vector v n (m a) -> m (Vector v n a)
- sequence_ :: (Monad m, Vector v (m a)) => Vector v n (m a) -> m ()
- prescanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a
- prescanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a
- postscanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a
- postscanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a
- scanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v (1 + n) a
- scanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v (1 + n) a
- scanl1 :: Vector v a => (a -> a -> a) -> Vector v (1 + n) a -> Vector v (2 + n) a
- scanl1' :: Vector v a => (a -> a -> a) -> Vector v (1 + n) a -> Vector v (2 + n) a
- prescanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b
- prescanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b
- postscanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b
- postscanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b
- scanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v (n + 1) b
- scanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v (n + 1) b
- scanr1 :: Vector v a => (a -> a -> a) -> Vector v (n + 1) a -> Vector v (n + 2) a
- scanr1' :: Vector v a => (a -> a -> a) -> Vector v (n + 1) a -> Vector v (n + 2) a
- toList :: Vector v a => Vector v n a -> [a]
- fromList :: (Vector v a, KnownNat n) => [a] -> Maybe (Vector v n a)
- fromListN :: forall v n a. (Vector v a, KnownNat n) => [a] -> Maybe (Vector v n a)
- fromListN' :: forall v n a p. (Vector v a, KnownNat n) => p n -> [a] -> Maybe (Vector v n a)
- withSizedList :: forall v a r. Vector v a => [a] -> (forall n. KnownNat n => Vector v n a -> r) -> r
- convert :: (Vector v a, Vector w a) => Vector v n a -> Vector w n a
- freeze :: (PrimMonad m, Vector v a) => MVector (Mutable v) n (PrimState m) a -> m (Vector v n a)
- thaw :: (PrimMonad m, Vector v a) => Vector v n a -> m (MVector (Mutable v) n (PrimState m) a)
- copy :: (PrimMonad m, Vector v a) => MVector (Mutable v) n (PrimState m) a -> Vector v n a -> m ()
- unsafeFreeze :: (PrimMonad m, Vector v a) => MVector (Mutable v) n (PrimState m) a -> m (Vector v n a)
- unsafeThaw :: (PrimMonad m, Vector v a) => Vector v n a -> m (MVector (Mutable v) n (PrimState m) a)
- toSized :: forall v n a. (Vector v a, KnownNat n) => v a -> Maybe (Vector v n a)
- withSized :: forall v a r. Vector v a => v a -> (forall n. KnownNat n => Vector v n a -> r) -> r
- fromSized :: Vector v n a -> v a
- withVectorUnsafe :: (v a -> w b) -> Vector v n a -> Vector w n b
Documentation
data Vector v (n :: Nat) a where Source #
A wrapper to tag vectors with a type level length.
Be careful when using the constructor here to not construct sized vectors which have a different length than that specified in the type parameter!
pattern SomeSized :: Vector v a => forall n. KnownNat n => Vector v n a -> v a | Pattern synonym that lets you treat an unsized vector as if it "contained" a sized vector. If you pattern match on an unsized vector, its contents will be the sized vector counterpart. testFunc :: Unsized.Vector Int -> Int testFunc ( The Without this, you would otherwise have to use testFunc :: Unsized.Vector Int -> Int testFunc u = Remember that the type of final result of your function (the This is especially useful in do blocks, where you can pattern match on
the unsized results of actions, to use the sized vector in the rest of
the do block. You also get a -- If you had: getAVector :: IO (Unsized.Vector Int) main :: IO () main = do SomeSized v <- getAVector -- v is `Sized.Vector n Int` print v -- alternatively, get n in scope SomeSized (v2 :: Sized.Vector n Int) <- getAVector print v2 Remember that the final type of the result of the do block ( Also useful in ghci, where you can pattern match to get sized vectors from unsized vectors. ghci> SomeSized v <- pure (myUnsizedVector :: Unsized.Vector Int) -- ^ v is `Sized.Vector n Int` This enables interactive exploration with sized vectors in ghci, and is useful for using with other libraries and functions that expect sized vectors in an interactive setting. (Note that as of GHC 8.6, you cannot get the You can also use this as a constructor, to take a sized vector and "hide" the size, to produce an unsized vector: SomeSized :: Sized.Vector n a -> Unsized.Vector a Note that due to quirks in GHC pattern synonym completeness checking, you will get incomplete pattern matches if you use this polymorphically over different vector types, or you use any vector type other than the three supported by this library (normal, storable, unboxed). |
Instances
KnownNat n => Monad (Vector Vector n) Source # | Treats a
|
Functor v => Functor (Vector v n) Source # | |
KnownNat n => Applicative (Vector Vector n) Source # | The |
Defined in Data.Vector.Generic.Sized pure :: a -> Vector Vector0 n a # (<*>) :: Vector Vector0 n (a -> b) -> Vector Vector0 n a -> Vector Vector0 n b # liftA2 :: (a -> b -> c) -> Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n c # (*>) :: Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n b # (<*) :: Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n a # | |
Foldable v => Foldable (Vector v n) Source # | |
Defined in Data.Vector.Generic.Sized.Internal fold :: Monoid m => Vector v n m -> m # foldMap :: Monoid m => (a -> m) -> Vector v n a -> m # foldMap' :: Monoid m => (a -> m) -> Vector v n a -> m # foldr :: (a -> b -> b) -> b -> Vector v n a -> b # foldr' :: (a -> b -> b) -> b -> Vector v n a -> b # foldl :: (b -> a -> b) -> b -> Vector v n a -> b # foldl' :: (b -> a -> b) -> b -> Vector v n a -> b # foldr1 :: (a -> a -> a) -> Vector v n a -> a # foldl1 :: (a -> a -> a) -> Vector v n a -> a # toList :: Vector v n a -> [a] # null :: Vector v n a -> Bool # length :: Vector v n a -> Int # elem :: Eq a => a -> Vector v n a -> Bool # maximum :: Ord a => Vector v n a -> a # minimum :: Ord a => Vector v n a -> a # | |
Traversable v => Traversable (Vector v n) Source # | |
Defined in Data.Vector.Generic.Sized.Internal | |
KnownNat n => Distributive (Vector Vector n) Source # | |
Defined in Data.Vector.Generic.Sized distribute :: Functor f => f (Vector Vector0 n a) -> Vector Vector0 n (f a) # collect :: Functor f => (a -> Vector Vector0 n b) -> f a -> Vector Vector0 n (f b) # distributeM :: Monad m => m (Vector Vector0 n a) -> Vector Vector0 n (m a) # collectM :: Monad m => (a -> Vector Vector0 n b) -> m a -> Vector Vector0 n (m b) # | |
KnownNat n => Representable (Vector Vector n) Source # | |
Eq1 v => Eq1 (Vector v n) Source # | |
Ord1 v => Ord1 (Vector v n) Source # | |
Defined in Data.Vector.Generic.Sized.Internal | |
Show1 v => Show1 (Vector v n) Source # | |
(KnownNat n, n ~ (1 + m)) => Comonad (Vector Vector n) Source # | Non-empty sized vectors are lawful comonads.
e.g.
|
(KnownNat n, n ~ (1 + m)) => ComonadApply (Vector Vector n) Source # | |
Eq (v a) => Eq (Vector v n a) Source # | |
(Vector v a, Floating a, KnownNat n) => Floating (Vector v n a) Source # | |
Defined in Data.Vector.Generic.Sized exp :: Vector v n a -> Vector v n a # log :: Vector v n a -> Vector v n a # sqrt :: Vector v n a -> Vector v n a # (**) :: Vector v n a -> Vector v n a -> Vector v n a # logBase :: Vector v n a -> Vector v n a -> Vector v n a # sin :: Vector v n a -> Vector v n a # cos :: Vector v n a -> Vector v n a # tan :: Vector v n a -> Vector v n a # asin :: Vector v n a -> Vector v n a # acos :: Vector v n a -> Vector v n a # atan :: Vector v n a -> Vector v n a # sinh :: Vector v n a -> Vector v n a # cosh :: Vector v n a -> Vector v n a # tanh :: Vector v n a -> Vector v n a # asinh :: Vector v n a -> Vector v n a # acosh :: Vector v n a -> Vector v n a # atanh :: Vector v n a -> Vector v n a # log1p :: Vector v n a -> Vector v n a # expm1 :: Vector v n a -> Vector v n a # | |
(Vector v a, Fractional a, KnownNat n) => Fractional (Vector v n a) Source # | |
(KnownNat n, Typeable v, Typeable a, Data (v a)) => Data (Vector v n a) Source # | |
Defined in Data.Vector.Generic.Sized.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Vector v n a -> c (Vector v n a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Vector v n a) # toConstr :: Vector v n a -> Constr # dataTypeOf :: Vector v n a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Vector v n a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Vector v n a)) # gmapT :: (forall b. Data b => b -> b) -> Vector v n a -> Vector v n a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Vector v n a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Vector v n a -> r # gmapQ :: (forall d. Data d => d -> u) -> Vector v n a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Vector v n a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a) # | |
(Vector v a, Num a, KnownNat n) => Num (Vector v n a) Source # | |
Defined in Data.Vector.Generic.Sized (+) :: Vector v n a -> Vector v n a -> Vector v n a # (-) :: Vector v n a -> Vector v n a -> Vector v n a # (*) :: Vector v n a -> Vector v n a -> Vector v n a # negate :: Vector v n a -> Vector v n a # abs :: Vector v n a -> Vector v n a # signum :: Vector v n a -> Vector v n a # fromInteger :: Integer -> Vector v n a # | |
Ord (v a) => Ord (Vector v n a) Source # | |
Defined in Data.Vector.Generic.Sized.Internal | |
(KnownNat n, Vector v a, Read (v a)) => Read (Vector v n a) Source # | |
Show (v a) => Show (Vector v n a) Source # | |
(Ix a, Ord (v a), Vector v a) => Ix (Vector v n a) Source # | |
Defined in Data.Vector.Generic.Sized.Internal range :: (Vector v n a, Vector v n a) -> [Vector v n a] # index :: (Vector v n a, Vector v n a) -> Vector v n a -> Int # unsafeIndex :: (Vector v n a, Vector v n a) -> Vector v n a -> Int # inRange :: (Vector v n a, Vector v n a) -> Vector v n a -> Bool # rangeSize :: (Vector v n a, Vector v n a) -> Int # unsafeRangeSize :: (Vector v n a, Vector v n a) -> Int # | |
(Semigroup g, Vector v g) => Semigroup (Vector v n g) Source # | The |
(Monoid m, Vector v m, KnownNat n) => Monoid (Vector v n m) Source # | The If |
(KnownNat n, Storable a, Vector v a) => Storable (Vector v n a) Source # | Any sized vector containing |
Defined in Data.Vector.Generic.Sized sizeOf :: Vector v n a -> Int # alignment :: Vector v n a -> Int # peekElemOff :: Ptr (Vector v n a) -> Int -> IO (Vector v n a) # pokeElemOff :: Ptr (Vector v n a) -> Int -> Vector v n a -> IO () # peekByteOff :: Ptr b -> Int -> IO (Vector v n a) # pokeByteOff :: Ptr b -> Int -> Vector v n a -> IO () # | |
(Vector v a, Binary a, KnownNat n) => Binary (Vector v n a) Source # | |
NFData (v a) => NFData (Vector v n a) Source # | |
Defined in Data.Vector.Generic.Sized.Internal | |
(Eq a, Hashable a, Unbox a) => Hashable (Vector Vector n a) Source # | |
(Eq a, Hashable a, Storable a) => Hashable (Vector Vector n a) Source # | |
(Eq a, Hashable a) => Hashable (Vector Vector n a) Source # | |
type Rep (Vector Vector n) Source # | |
Defined in Data.Vector.Generic.Sized | |
type Mutable (Vector v n) Source # | |
Defined in Data.Vector.Generic.Sized |
data MVector v (n :: Nat) s a Source #
A wrapper to tag mutable vectors with a type level length.
Be careful when using the constructor here to not construct sized vectors which have a different length than that specified in the type parameter!
Instances
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) => Data (MVector v n s a) Source # | |
Defined in Data.Vector.Generic.Mutable.Sized.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MVector v n s a -> c (MVector v n s a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (MVector v n s a) # toConstr :: MVector v n s a -> Constr # dataTypeOf :: MVector v n s a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (MVector v n s a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (MVector v n s a)) # gmapT :: (forall b. Data b => b -> b) -> MVector v n s a -> MVector v n s a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r # gmapQ :: (forall d. Data d => d -> u) -> MVector v n s a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> MVector v n s a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> MVector v n s a -> m (MVector v n s a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MVector v n s a -> m (MVector v n s a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MVector v n s a -> m (MVector v n s a) # | |
Storable (v s a) => Storable (MVector v n s a) Source # | |
Defined in Data.Vector.Generic.Mutable.Sized.Internal sizeOf :: MVector v n s a -> Int # alignment :: MVector v n s a -> Int # peekElemOff :: Ptr (MVector v n s a) -> Int -> IO (MVector v n s a) # pokeElemOff :: Ptr (MVector v n s a) -> Int -> MVector v n s a -> IO () # peekByteOff :: Ptr b -> Int -> IO (MVector v n s a) # pokeByteOff :: Ptr b -> Int -> MVector v n s a -> IO () # | |
NFData (v s a) => NFData (MVector v n s a) Source # | |
Defined in Data.Vector.Generic.Mutable.Sized.Internal |
Accessors
Length information
:: forall v n a r. Vector v a | |
=> Vector v n a | a vector of some (potentially unknown) length |
-> (KnownNat n => r) | a value that depends on knowing the vector's length |
-> r | the value computed with the length |
O(1) Reveal a KnownNat
instance for a vector's length, determined
at runtime.
Indexing
index :: forall v n a. Vector v a => Vector v n a -> Finite n -> a Source #
O(1) Safe indexing using a Finite
.
index' :: forall v n m a p. (KnownNat n, Vector v a) => Vector v ((n + m) + 1) a -> p n -> a Source #
O(1) Safe indexing using a Proxy
.
unsafeIndex :: forall v n a. Vector v a => Vector v n a -> Int -> a Source #
O(1) Indexing using an Int
without bounds checking.
head :: forall v n a. Vector v a => Vector v (1 + n) a -> a Source #
O(1) Yield the first element of a non-empty vector.
last :: forall v n a. Vector v a => Vector v (n + 1) a -> a Source #
O(1) Yield the last element of a non-empty vector.
Monadic indexing
indexM :: forall v n a m. (Vector v a, Monad m) => Vector v n a -> Finite n -> m a Source #
O(1) Safe indexing in a monad.
The monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this:
copy mv v = ... write mv i (v ! i) ...
For lazy vectors, v ! i
would not be evaluated, which means that mv
would
unnecessarily retain a reference to v
in each element when written.
With indexM
, copying can be implemented like this instead:
copy mv v = ... do x <- indexM v i write mv i x
Here, no references to v
are retained, because indexing (but not the
elements) are evaluated eagerly.
indexM' :: forall v n k a m p. (KnownNat n, Vector v a, Monad m) => Vector v (n + k) a -> p n -> m a Source #
unsafeIndexM :: forall v n a m. (Vector v a, Monad m) => Vector v n a -> Int -> m a Source #
O(1) Indexing using an Int without bounds checking. See the
documentation for indexM
for an explanation of why this is useful.
headM :: forall v n a m. (Vector v a, Monad m) => Vector v (1 + n) a -> m a Source #
O(1) Yield the first element of a non-empty vector in a monad. See the
documentation for indexM
for an explanation of why this is useful.
lastM :: forall v n a m. (Vector v a, Monad m) => Vector v (n + 1) a -> m a Source #
O(1) Yield the last element of a non-empty vector in a monad. See the
documentation for indexM
for an explanation of why this is useful.
Extracting subvectors (slicing)
:: forall v i n m a p. (KnownNat i, KnownNat n, Vector v a) | |
=> p i | starting index |
-> Vector v ((i + n) + m) a | |
-> Vector v n a |
O(1) Yield a slice of the vector without copying it with an inferred length argument.
:: forall v i n m a p. (KnownNat i, KnownNat n, Vector v a) | |
=> p i | starting index |
-> p n | length |
-> Vector v ((i + n) + m) a | |
-> Vector v n a |
O(1) Yield a slice of the vector without copying it with an explicit length argument.
init :: forall v n a. Vector v a => Vector v (n + 1) a -> Vector v n a Source #
O(1) Yield all but the last element of a non-empty vector without copying.
tail :: forall v n a. Vector v a => Vector v (1 + n) a -> Vector v n a Source #
O(1) Yield all but the first element of a non-empty vector without copying.
take :: forall v n m a. (KnownNat n, Vector v a) => Vector v (n + m) a -> Vector v n a Source #
O(1) Yield the first n
elements. The resulting vector always contains
this many elements. The length of the resulting vector is inferred from the
type.
take' :: forall v n m a p. (KnownNat n, Vector v a) => p n -> Vector v (n + m) a -> Vector v n a Source #
O(1) Yield the first n
elements. The resulting vector always contains
this many elements. The length of the resulting vector is given explicitly
as a Proxy
argument.
drop :: forall v n m a. (KnownNat n, Vector v a) => Vector v (n + m) a -> Vector v m a Source #
O(1) Yield all but the the first n
elements. The given vector must
contain at least this many elements. The length of the resulting vector is
inferred from the type.
drop' :: forall v n m a p. (KnownNat n, Vector v a) => p n -> Vector v (n + m) a -> Vector v m a Source #
O(1) Yield all but the the first n
elements. The given vector must
contain at least this many elements. The length of the resulting vector is
givel explicitly as a Proxy
argument.
splitAt :: forall v n m a. (KnownNat n, Vector v a) => Vector v (n + m) a -> (Vector v n a, Vector v m a) Source #
O(1) Yield the first n
elements, paired with the rest, without copying.
The lengths of the resulting vectors are inferred from the type.
splitAt' :: forall v n m a p. (KnownNat n, Vector v a) => p n -> Vector v (n + m) a -> (Vector v n a, Vector v m a) Source #
O(1) Yield the first n
elements, paired with the rest, without
copying. The length of the first resulting vector is passed explicitly as a
Proxy
argument.
Construction
Initialization
singleton :: forall v a. Vector v a => a -> Vector v 1 a Source #
O(1) Vector with exactly one element.
fromTuple :: forall v a input length. (Vector v a, IndexedListLiterals input length a, KnownNat length) => input -> Vector v length a Source #
O(n) Construct a vector in a type-safe manner.
fromTuple (1,2) :: Vector v 2 Int
fromTuple ("hey", "what's", "going", "on") :: Vector v 4 String
replicate :: forall v n a. (KnownNat n, Vector v a) => a -> Vector v n a Source #
O(n) Construct a vector with the same element in each position where the length is inferred from the type.
replicate' :: forall v n a p. (KnownNat n, Vector v a) => p n -> a -> Vector v n a Source #
O(n) Construct a vector with the same element in each position where the
length is given explicitly as a Proxy
argument.
generate :: forall v n a. (KnownNat n, Vector v a) => (Finite n -> a) -> Vector v n a Source #
O(n) Construct a vector of the given length by applying the function to each index where the length is inferred from the type.
generate' :: forall v n a p. (KnownNat n, Vector v a) => p n -> (Finite n -> a) -> Vector v n a Source #
O(n) Construct a vector of the given length by applying the function to
each index where the length is given explicitly as a Proxy
argument.
iterateN :: forall v n a. (KnownNat n, Vector v a) => (a -> a) -> a -> Vector v n a Source #
O(n) Apply the function n
times to a value. Zeroth element is the original value.
The length is inferred from the type.
iterateN' :: forall v n a p. (KnownNat n, Vector v a) => p n -> (a -> a) -> a -> Vector v n a Source #
O(n) Apply the function n
times to a value. Zeroth element is the original value.
The length is given explicitly as a Proxy
argument.
Monadic initialization
replicateM :: forall v n m a. (KnownNat n, Vector v a, Monad m) => m a -> m (Vector v n a) Source #
O(n) Execute the monadic action n
times and store the results in a
vector where n
is inferred from the type.
replicateM' :: forall v n m a p. (KnownNat n, Vector v a, Monad m) => p n -> m a -> m (Vector v n a) Source #
O(n) Execute the monadic action n
times and store the results in a
vector where n
is given explicitly as a Proxy
argument.
generateM :: forall v n m a. (KnownNat n, Vector v a, Monad m) => (Finite n -> m a) -> m (Vector v n a) Source #
O(n) Construct a vector of length n
by applying the monadic action to
each index where n
is inferred from the type.
generateM' :: forall v n m a p. (KnownNat n, Vector v a, Monad m) => p n -> (Finite n -> m a) -> m (Vector v n a) Source #
O(n) Construct a vector of length n
by applying the monadic action to
each index where n
is given explicitly as a Proxy
argument.
Unfolding
unfoldrN :: forall v n a b. (KnownNat n, Vector v a) => (b -> (a, b)) -> b -> Vector v n a Source #
O(n) Construct a vector with exactly n
elements by repeatedly applying
the generator function to the a seed. The length is inferred from the
type.
unfoldrN' :: forall v n a b p. (KnownNat n, Vector v a) => p n -> (b -> (a, b)) -> b -> Vector v n a Source #
O(n) Construct a vector with exactly n
elements by repeatedly applying
the generator function to the a seed. The length is given explicitly
as a Proxy
argument.
Enumeration
enumFromN :: forall v n a. (KnownNat n, Vector v a, Num a) => a -> Vector v n a Source #
O(n) Yield a vector of length n
containing the values x
, x+1
,
... x + (n - 1)
. The length is inferred from the type.
enumFromN' :: forall v n a p. (KnownNat n, Vector v a, Num a) => a -> p n -> Vector v n a Source #
O(n) Yield a vector of length n
containing the values x
, x+1
,
..., x + (n - 1)
The length is given explicitly as a Proxy
argument.
enumFromStepN :: forall v n a. (KnownNat n, Vector v a, Num a) => a -> a -> Vector v n a Source #
O(n) Yield a vector of the given length containing the values x
, x+y
,
x+2y
, ... x + (n - 1)y
. The length is inferred from the type.
enumFromStepN' :: forall v n a p. (KnownNat n, Vector v a, Num a) => a -> a -> p n -> Vector v n a Source #
O(n) Yield a vector of the given length containing the values x
, x+y
,
x+2y
, ..., x + (n - 1)y
. The length is given explicitly as a Proxy
argument.
Concatenation
cons :: forall v n a. Vector v a => a -> Vector v n a -> Vector v (1 + n) a Source #
O(n) Prepend an element.
snoc :: forall v n a. Vector v a => Vector v n a -> a -> Vector v (n + 1) a Source #
O(n) Append an element.
(++) :: forall v n m a. Vector v a => Vector v n a -> Vector v m a -> Vector v (n + m) a Source #
O(m+n) Concatenate two vectors.
Restricting memory usage
force :: Vector v a => Vector v n a -> Vector v n a Source #
O(n) Yield the argument but force it not to retain any extra memory, possibly by copying it.
This is especially useful when dealing with slices. For example:
force (slice 0 2 <huge vector>)
Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.
Modifying vectors
Bulk updates
:: Vector v a | |
=> Vector v m a | initial vector (of length |
-> [(Finite m, a)] | list of index/value pairs (of length |
-> Vector v m a |
O(m+n) For each pair (i,a)
from the list, replace the vector
element at position i
by a
.
<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>
:: (Vector v a, Vector v (Int, a)) | |
=> Vector v m a | initial vector (of length |
-> Vector v n (Int, a) | vector of index/value pairs (of length |
-> Vector v m a |
O(m+n) For each pair (i,a)
from the vector of index/value pairs,
replace the vector element at position i
by a
.
update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>
:: (Vector v a, Vector v Int) | |
=> Vector v m a | initial vector (of length |
-> Vector v n Int | index vector (of length |
-> Vector v n a | value vector (of length |
-> Vector v m a |
O(m+n) For each index i
from the index vector and the
corresponding value a
from the value vector, replace the element of the
initial vector at position i
by a
.
update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>
This function is useful for instances of Vector
that cannot store pairs.
Otherwise, update
is probably more convenient.
update_ xs is ys =update
xs (zip
is ys)
:: Vector v a | |
=> Vector v m a | initial vector (of length |
-> [(Int, a)] | list of index/value pairs (of length |
-> Vector v m a |
Same as (//
) but without bounds checking.
:: (Vector v a, Vector v (Int, a)) | |
=> Vector v m a | initial vector (of length |
-> Vector v n (Int, a) | vector of index/value pairs (of length |
-> Vector v m a |
Same as update
but without bounds checking.
:: (Vector v a, Vector v Int) | |
=> Vector v m a | initial vector (of length |
-> Vector v n Int | index vector (of length |
-> Vector v n a | value vector (of length |
-> Vector v m a |
Same as update_
but without bounds checking.
Accumulations
:: Vector v a | |
=> (a -> b -> a) | accumulating function |
-> Vector v m a | initial vector (of length |
-> [(Int, b)] | list of index/value pairs (of length |
-> Vector v m a |
O(m+n) For each pair (i,b)
from the list, replace the vector element
a
at position i
by f a b
.
accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>
:: (Vector v a, Vector v (Int, b)) | |
=> (a -> b -> a) | accumulating function |
-> Vector v m a | initial vector (of length |
-> Vector v n (Int, b) | vector of index/value pairs (of length |
-> Vector v m a |
O(m+n) For each pair (i,b)
from the vector of pairs, replace the vector
element a
at position i
by f a b
.
accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>
:: (Vector v a, Vector v Int, Vector v b) | |
=> (a -> b -> a) | accumulating function |
-> Vector v m a | initial vector (of length |
-> Vector v n Int | index vector (of length |
-> Vector v n b | value vector (of length |
-> Vector v m a |
O(m+n) For each index i
from the index vector and the
corresponding value b
from the the value vector,
replace the element of the initial vector at
position i
by f a b
.
accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>
This function is useful for instances of Vector
that cannot store pairs.
Otherwise, accumulate
is probably more convenient:
accumulate_ f as is bs =accumulate
f as (zip
is bs)
:: Vector v a | |
=> (a -> b -> a) | accumulating function |
-> Vector v m a | initial vector (of length |
-> [(Int, b)] | list of index/value pairs (of length |
-> Vector v m a |
Same as accum
but without bounds checking.
:: (Vector v a, Vector v (Int, b)) | |
=> (a -> b -> a) | accumulating function |
-> Vector v m a | initial vector (of length |
-> Vector v n (Int, b) | vector of index/value pairs (of length |
-> Vector v m a |
Same as accumulate
but without bounds checking.
:: (Vector v a, Vector v Int, Vector v b) | |
=> (a -> b -> a) | accumulating function |
-> Vector v m a | initial vector (of length |
-> Vector v n Int | index vector (of length |
-> Vector v n b | value vector (of length |
-> Vector v m a |
Same as accumulate_
but without bounds checking.
Permutations
:: (Vector v a, Vector v Int) | |
=> Vector v m a |
|
-> Vector v n Int |
|
-> Vector v n a |
O(n) Yield the vector obtained by replacing each element i
of the
index vector by xs
. This is equivalent to !
i
but is
often much more efficient.map
(xs!
) is
backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>
:: (Vector v a, Vector v Int) | |
=> Vector v m a |
|
-> Vector v n Int |
|
-> Vector v n a |
Same as backpermute
but without bounds checking.
Lenses
ix :: forall v n a f. (Vector v a, Functor f) => Finite n -> (a -> f a) -> Vector v n a -> f (Vector v n a) Source #
Lens to access (O(1)) and update (O(n)) an arbitrary element by its index.
_head :: forall v n a f. (Vector v a, Functor f) => (a -> f a) -> Vector v (1 + n) a -> f (Vector v (1 + n) a) Source #
Lens to access (O(1)) and update (O(n)) the first element of a non-empty vector.
_last :: forall v n a f. (Vector v a, Functor f) => (a -> f a) -> Vector v (n + 1) a -> f (Vector v (n + 1) a) Source #
Lens to access (O(1)) and update (O(n)) the last element of a non-empty vector.
Elementwise operations
Indexing
indexed :: (Vector v a, Vector v (Int, a), Vector v (Finite n, a)) => Vector v n a -> Vector v n (Finite n, a) Source #
O(n) Pair each element in a vector with its index.
Mapping
map :: (Vector v a, Vector v b) => (a -> b) -> Vector v n a -> Vector v n b Source #
O(n) Map a function over a vector.
imap :: (Vector v a, Vector v b) => (Finite n -> a -> b) -> Vector v n a -> Vector v n b Source #
O(n) Apply a function to every element of a vector and its index.
concatMap :: (Vector v a, Vector v' b) => (a -> Vector v' m b) -> Vector v n a -> Vector v' (n * m) b Source #
O(n*m) Map a function over a vector and concatenate the results. The function is required to always return a vector of the same length.
Monadic mapping
mapM :: (Monad m, Vector v a, Vector v b) => (a -> m b) -> Vector v n a -> m (Vector v n b) Source #
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
imapM :: (Monad m, Vector v a, Vector v b) => (Finite n -> a -> m b) -> Vector v n a -> m (Vector v n b) Source #
O(n) Apply the monadic action to every element of a vector and its index, yielding a vector of results.
mapM_ :: (Monad m, Vector v a) => (a -> m b) -> Vector v n a -> m () Source #
O(n) Apply the monadic action to all elements of a vector and ignore the results.
imapM_ :: (Monad m, Vector v a) => (Finite n -> a -> m b) -> Vector v n a -> m () Source #
O(n) Apply the monadic action to every element of a vector and its index, ignoring the results.
forM :: (Monad m, Vector v a, Vector v b) => Vector v n a -> (a -> m b) -> m (Vector v n b) Source #
O(n) Apply the monadic action to all elements of the vector, yielding a
vector of results. Equvalent to flip
.mapM
forM_ :: (Monad m, Vector v a) => Vector v n a -> (a -> m b) -> m () Source #
O(n) Apply the monadic action to all elements of a vector and ignore the
results. Equivalent to flip
.mapM_
Zipping
zipWith :: (Vector v a, Vector v b, Vector v c) => (a -> b -> c) -> Vector v n a -> Vector v n b -> Vector v n c Source #
O(n) Zip two vectors of the same length with the given function.
zipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (a -> b -> c -> d) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d Source #
Zip three vectors with the given function.
zipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (a -> b -> c -> d -> e) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e Source #
zipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (a -> b -> c -> d -> e -> f) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f Source #
zipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (a -> b -> c -> d -> e -> f -> g) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f -> Vector v n g Source #
izipWith :: (Vector v a, Vector v b, Vector v c) => (Finite n -> a -> b -> c) -> Vector v n a -> Vector v n b -> Vector v n c Source #
O(n) Zip two vectors of the same length with a function that also takes the elements' indices).
izipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (Finite n -> a -> b -> c -> d) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d Source #
izipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (Finite n -> a -> b -> c -> d -> e) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e Source #
izipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (Finite n -> a -> b -> c -> d -> e -> f) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f Source #
izipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (Finite n -> a -> b -> c -> d -> e -> f -> g) -> Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f -> Vector v n g Source #
zip :: (Vector v a, Vector v b, Vector v (a, b)) => Vector v n a -> Vector v n b -> Vector v n (a, b) Source #
O(n) Zip two vectors of the same length
zip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => Vector v n a -> Vector v n b -> Vector v n c -> Vector v n (a, b, c) Source #
zip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n (a, b, c, d) Source #
zip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n (a, b, c, d, e) Source #
zip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => Vector v n a -> Vector v n b -> Vector v n c -> Vector v n d -> Vector v n e -> Vector v n f -> Vector v n (a, b, c, d, e, f) Source #
Monadic zipping
zipWithM :: (Monad m, Vector v a, Vector v b, Vector v c) => (a -> b -> m c) -> Vector v n a -> Vector v n b -> m (Vector v n c) Source #
O(n) Zip the two vectors of the same length with the monadic action and yield a vector of results.
izipWithM :: (Monad m, Vector v a, Vector v b, Vector v c) => (Finite n -> a -> b -> m c) -> Vector v n a -> Vector v n b -> m (Vector v n c) Source #
O(n) Zip the two vectors with a monadic action that also takes the element index and yield a vector of results.
zipWithM_ :: (Monad m, Vector v a, Vector v b) => (a -> b -> m c) -> Vector v n a -> Vector v n b -> m () Source #
O(n) Zip the two vectors with the monadic action and ignore the results.
izipWithM_ :: (Monad m, Vector v a, Vector v b) => (Finite n -> a -> b -> m c) -> Vector v n a -> Vector v n b -> m () Source #
O(n) Zip the two vectors with a monadic action that also takes the element index and ignore the results.
Unzipping
unzip :: (Vector v a, Vector v b, Vector v (a, b)) => Vector v n (a, b) -> (Vector v n a, Vector v n b) Source #
O(min(m,n)) Unzip a vector of pairs.
unzip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => Vector v n (a, b, c) -> (Vector v n a, Vector v n b, Vector v n c) Source #
unzip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => Vector v n (a, b, c, d) -> (Vector v n a, Vector v n b, Vector v n c, Vector v n d) Source #
unzip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => Vector v n (a, b, c, d, e) -> (Vector v n a, Vector v n b, Vector v n c, Vector v n d, Vector v n e) Source #
unzip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => Vector v n (a, b, c, d, e, f) -> (Vector v n a, Vector v n b, Vector v n c, Vector v n d, Vector v n e, Vector v n f) Source #
Working with predicates
Searching
elem :: (Vector v a, Eq a) => a -> Vector v n a -> Bool infix 4 Source #
O(n) Check if the vector contains an element.
notElem :: (Vector v a, Eq a) => a -> Vector v n a -> Bool infix 4 Source #
O(n) Check if the vector does not contain an element (inverse of elem
).
Folding
foldl1 :: Vector v a => (a -> a -> a) -> Vector v (1 + n) a -> a Source #
O(n) Left fold on non-empty vectors.
foldl' :: Vector v b => (a -> b -> a) -> a -> Vector v n b -> a Source #
O(n) Left fold with strict accumulator.
foldl1' :: Vector v a => (a -> a -> a) -> Vector v (1 + n) a -> a Source #
O(n) Left fold on non-empty vectors with strict accumulator.
foldr1 :: Vector v a => (a -> a -> a) -> Vector v (n + 1) a -> a Source #
O(n) Right fold on non-empty vectors.
foldr' :: Vector v a => (a -> b -> b) -> b -> Vector v n a -> b Source #
O(n) Right fold with a strict accumulator.
foldr1' :: Vector v a => (a -> a -> a) -> Vector v (n + 1) a -> a Source #
O(n) Right fold on non-empty vectors with strict accumulator.
ifoldl :: Vector v b => (a -> Finite n -> b -> a) -> a -> Vector v n b -> a Source #
O(n) Left fold (function applied to each element and its index).
ifoldl' :: Vector v b => (a -> Finite n -> b -> a) -> a -> Vector v n b -> a Source #
O(n) Left fold with strict accumulator (function applied to each element and its index).
ifoldr :: Vector v a => (Finite n -> a -> b -> b) -> b -> Vector v n a -> b Source #
O(n) Right fold (function applied to each element and its index).
ifoldr' :: Vector v a => (Finite n -> a -> b -> b) -> b -> Vector v n a -> b Source #
O(n) Right fold with strict accumulator (function applied to each element and its index).
Specialised folds
all :: Vector v a => (a -> Bool) -> Vector v n a -> Bool Source #
O(n) Check if all elements satisfy the predicate.
any :: Vector v a => (a -> Bool) -> Vector v n a -> Bool Source #
O(n) Check if any element satisfies the predicate.
product :: (Vector v a, Num a) => Vector v n a -> a Source #
O(n) Compute the product of the elements.
maximum :: (Vector v a, Ord a) => Vector v (n + 1) a -> a Source #
O(n) Yield the maximum element of the non-empty vector.
maximumBy :: Vector v a => (a -> a -> Ordering) -> Vector v (n + 1) a -> a Source #
O(n) Yield the maximum element of the non-empty vector according to the given comparison function.
minimum :: (Vector v a, Ord a) => Vector v (n + 1) a -> a Source #
O(n) Yield the minimum element of the non-empty vector.
minimumBy :: Vector v a => (a -> a -> Ordering) -> Vector v (n + 1) a -> a Source #
O(n) Yield the minimum element of the non-empty vector according to the given comparison function.
maxIndex :: (Vector v a, Ord a) => Vector v (n + 1) a -> Finite (n + 1) Source #
O(n) Yield the index of the maximum element of the non-empty vector.
maxIndexBy :: Vector v a => (a -> a -> Ordering) -> Vector v (n + 1) a -> Finite (n + 1) Source #
O(n) Yield the index of the maximum element of the non-empty vector according to the given comparison function.
minIndex :: (Vector v a, Ord a) => Vector v (n + 1) a -> Finite (n + 1) Source #
O(n) Yield the index of the minimum element of the non-empty vector.
minIndexBy :: Vector v a => (a -> a -> Ordering) -> Vector v (n + 1) a -> Finite (n + 1) Source #
O(n) Yield the index of the minimum element of the non-empty vector according to the given comparison function.
Monadic folds
foldM :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m a Source #
O(n) Monadic fold.
ifoldM :: (Monad m, Vector v b) => (a -> Finite n -> b -> m a) -> a -> Vector v n b -> m a Source #
O(n) Monadic fold (action applied to each element and its index).
fold1M :: (Monad m, Vector v a) => (a -> a -> m a) -> Vector v (1 + n) a -> m a Source #
O(n) Monadic fold over non-empty vectors.
foldM' :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m a Source #
O(n) Monadic fold with strict accumulator.
ifoldM' :: (Monad m, Vector v b) => (a -> Finite n -> b -> m a) -> a -> Vector v n b -> m a Source #
O(n) Monadic fold with strict accumulator (action applied to each element and its index).
fold1M' :: (Monad m, Vector v a) => (a -> a -> m a) -> Vector v (n + 1) a -> m a Source #
O(n) Monadic fold over non-empty vectors with strict accumulator.
foldM_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m () Source #
O(n) Monadic fold that discards the result.
ifoldM_ :: (Monad m, Vector v b) => (a -> Finite n -> b -> m a) -> a -> Vector v n b -> m () Source #
O(n) Monadic fold that discards the result (action applied to each element and its index).
fold1M_ :: (Monad m, Vector v a) => (a -> a -> m a) -> Vector v (n + 1) a -> m () Source #
O(n) Monadic fold over non-empty vectors that discards the result.
foldM'_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m () Source #
O(n) Monadic fold with strict accumulator that discards the result.
ifoldM'_ :: (Monad m, Vector v b) => (a -> Finite n -> b -> m a) -> a -> Vector v n b -> m () Source #
O(n) Monadic fold with strict accumulator that discards the result (action applied to each element and its index).
fold1M'_ :: (Monad m, Vector v a) => (a -> a -> m a) -> Vector v (n + 1) a -> m () Source #
O(n) Monad fold over non-empty vectors with strict accumulator that discards the result.
Monadic sequencing
sequence :: (Monad m, Vector v a, Vector v (m a)) => Vector v n (m a) -> m (Vector v n a) Source #
Evaluate each action and collect the results.
sequence_ :: (Monad m, Vector v (m a)) => Vector v n (m a) -> m () Source #
Evaluate each action and discard the results.
Prefix sums (scans)
prescanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a Source #
O(n) Prescan with strict accumulator.
postscanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a Source #
O(n) Scan
postscanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a Source #
O(n) Scan with strict accumulator.
scanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v (1 + n) a Source #
O(n) Haskell-style scan.
scanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v (1 + n) a Source #
O(n) Haskell-style scan with strict accumulator.
scanl1 :: Vector v a => (a -> a -> a) -> Vector v (1 + n) a -> Vector v (2 + n) a Source #
O(n) Scan over a non-empty vector.
scanl1' :: Vector v a => (a -> a -> a) -> Vector v (1 + n) a -> Vector v (2 + n) a Source #
O(n) Scan over a non-empty vector with a strict accumulator.
prescanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b Source #
O(n) Right-to-left prescan.
prescanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b Source #
O(n) Right-to-left prescan with strict accumulator.
postscanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b Source #
O(n) Right-to-left scan.
postscanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b Source #
O(n) Right-to-left scan with strict accumulator.
scanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v (n + 1) b Source #
O(n) Right-to-left Haskell-style scan.
scanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v (n + 1) b Source #
O(n) Right-to-left Haskell-style scan with strict accumulator.
scanr1 :: Vector v a => (a -> a -> a) -> Vector v (n + 1) a -> Vector v (n + 2) a Source #
O(n) Right-to-left scan over a non-empty vector.
scanr1' :: Vector v a => (a -> a -> a) -> Vector v (n + 1) a -> Vector v (n + 2) a Source #
O(n) Right-to-left scan over a non-empty vector with a strict accumulator.
Conversions
Lists
fromList :: (Vector v a, KnownNat n) => [a] -> Maybe (Vector v n a) Source #
O(n) Convert a list to a vector.
fromListN :: forall v n a. (Vector v a, KnownNat n) => [a] -> Maybe (Vector v n a) Source #
O(n) Convert the first n
elements of a list to a vector. The length of
the resultant vector is inferred from the type.
fromListN' :: forall v n a p. (Vector v a, KnownNat n) => p n -> [a] -> Maybe (Vector v n a) Source #
O(n) Convert the first n
elements of a list to a vector. The length of
the resultant vector is given explicitly as a Proxy
argument.
withSizedList :: forall v a r. Vector v a => [a] -> (forall n. KnownNat n => Vector v n a -> r) -> r Source #
O(n) Takes a list and returns a continuation providing a vector with a size parameter corresponding to the length of the list.
Essentially converts a list into a vector with the proper size parameter, determined at runtime.
See withSized
Other Vector types
convert :: (Vector v a, Vector w a) => Vector v n a -> Vector w n a Source #
O(n) Convert different vector types.
Mutable vectors
freeze :: (PrimMonad m, Vector v a) => MVector (Mutable v) n (PrimState m) a -> m (Vector v n a) Source #
O(n) Yield an immutable copy of the mutable vector.
thaw :: (PrimMonad m, Vector v a) => Vector v n a -> m (MVector (Mutable v) n (PrimState m) a) Source #
O(n) Yield a mutable copy of the immutable vector.
copy :: (PrimMonad m, Vector v a) => MVector (Mutable v) n (PrimState m) a -> Vector v n a -> m () Source #
O(n) Copy an immutable vector into a mutable one.
unsafeFreeze :: (PrimMonad m, Vector v a) => MVector (Mutable v) n (PrimState m) a -> m (Vector v n a) Source #
O(1) Unsafely convert a mutable vector to an immutable one withouy copying. The mutable vector may not be used after this operation.
unsafeThaw :: (PrimMonad m, Vector v a) => Vector v n a -> m (MVector (Mutable v) n (PrimState m) a) Source #
O(n) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.
Unsized Vectors
withSized :: forall v a r. Vector v a => v a -> (forall n. KnownNat n => Vector v n a -> r) -> r Source #
withVectorUnsafe :: (v a -> w b) -> Vector v n a -> Vector w n b Source #
Apply a function on unsized vectors to a sized vector. The function must preserve the size of the vector, this is not checked.
Orphan instances
KnownNat n => Monad (Vector Vector n) Source # | Treats a
|
KnownNat n => Applicative (Vector Vector n) Source # | The |
pure :: a -> Vector Vector0 n a # (<*>) :: Vector Vector0 n (a -> b) -> Vector Vector0 n a -> Vector Vector0 n b # liftA2 :: (a -> b -> c) -> Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n c # (*>) :: Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n b # (<*) :: Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n a # | |
KnownNat n => Distributive (Vector Vector n) Source # | |
distribute :: Functor f => f (Vector Vector0 n a) -> Vector Vector0 n (f a) # collect :: Functor f => (a -> Vector Vector0 n b) -> f a -> Vector Vector0 n (f b) # distributeM :: Monad m => m (Vector Vector0 n a) -> Vector Vector0 n (m a) # collectM :: Monad m => (a -> Vector Vector0 n b) -> m a -> Vector Vector0 n (m b) # | |
KnownNat n => Representable (Vector Vector n) Source # | |
(KnownNat n, n ~ (1 + m)) => Comonad (Vector Vector n) Source # | Non-empty sized vectors are lawful comonads.
e.g.
|
(KnownNat n, n ~ (1 + m)) => ComonadApply (Vector Vector n) Source # | |
(Vector v a, Floating a, KnownNat n) => Floating (Vector v n a) Source # | |
exp :: Vector v n a -> Vector v n a # log :: Vector v n a -> Vector v n a # sqrt :: Vector v n a -> Vector v n a # (**) :: Vector v n a -> Vector v n a -> Vector v n a # logBase :: Vector v n a -> Vector v n a -> Vector v n a # sin :: Vector v n a -> Vector v n a # cos :: Vector v n a -> Vector v n a # tan :: Vector v n a -> Vector v n a # asin :: Vector v n a -> Vector v n a # acos :: Vector v n a -> Vector v n a # atan :: Vector v n a -> Vector v n a # sinh :: Vector v n a -> Vector v n a # cosh :: Vector v n a -> Vector v n a # tanh :: Vector v n a -> Vector v n a # asinh :: Vector v n a -> Vector v n a # acosh :: Vector v n a -> Vector v n a # atanh :: Vector v n a -> Vector v n a # log1p :: Vector v n a -> Vector v n a # expm1 :: Vector v n a -> Vector v n a # | |
(Vector v a, Fractional a, KnownNat n) => Fractional (Vector v n a) Source # | |
(Vector v a, Num a, KnownNat n) => Num (Vector v n a) Source # | |
(+) :: Vector v n a -> Vector v n a -> Vector v n a # (-) :: Vector v n a -> Vector v n a -> Vector v n a # (*) :: Vector v n a -> Vector v n a -> Vector v n a # negate :: Vector v n a -> Vector v n a # abs :: Vector v n a -> Vector v n a # signum :: Vector v n a -> Vector v n a # fromInteger :: Integer -> Vector v n a # | |
(KnownNat n, Vector v a, Read (v a)) => Read (Vector v n a) Source # | |
(Semigroup g, Vector v g) => Semigroup (Vector v n g) Source # | The |
(Monoid m, Vector v m, KnownNat n) => Monoid (Vector v n m) Source # | The If |
(KnownNat n, Storable a, Vector v a) => Storable (Vector v n a) Source # | Any sized vector containing |
sizeOf :: Vector v n a -> Int # alignment :: Vector v n a -> Int # peekElemOff :: Ptr (Vector v n a) -> Int -> IO (Vector v n a) # pokeElemOff :: Ptr (Vector v n a) -> Int -> Vector v n a -> IO () # peekByteOff :: Ptr b -> Int -> IO (Vector v n a) # pokeByteOff :: Ptr b -> Int -> Vector v n a -> IO () # | |
(Vector v a, Binary a, KnownNat n) => Binary (Vector v n a) Source # | |
(Eq a, Hashable a, Unbox a) => Hashable (Vector Vector n a) Source # | |
(Eq a, Hashable a, Storable a) => Hashable (Vector Vector n a) Source # | |
(Eq a, Hashable a) => Hashable (Vector Vector n a) Source # | |