-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Size tagged vectors
--   
--   Please see README.md
@package vector-sized
@version 0.5.1.0


-- | This module reexports the functionality in <a>Generic</a> which maps
--   well to explicity sized vectors.
--   
--   Functions returning a vector determine the size from the type context
--   unless they have a <tt>'</tt> suffix in which case they take an
--   explicit <a>Proxy</a> argument.
--   
--   Functions where the resultant vector size is not know until compile
--   time are not exported.
module Data.Vector.Generic.Sized

-- | A wrapper to tag vectors with a type level length.
data Vector v (n :: Nat) a

-- | <i>O(1)</i> Yield the length of the vector as an <a>Int</a>.
length :: forall v n a. (KnownNat n) => Vector v n a -> Int

-- | <i>O(1)</i> Yield the length of the vector as a <a>Proxy</a>.
length' :: forall v n a. (KnownNat n) => Vector v n a -> Proxy n

-- | <i>O(1)</i> Safe indexing using a <a>Finite</a>.
index :: forall v n a. (KnownNat n, Vector v a) => Vector v n a -> Finite n -> a

-- | <i>O(1)</i> Safe indexing using a <a>Proxy</a>.
index' :: forall v n m a. (KnownNat n, KnownNat m, Vector v a) => Vector v ((n + m) + 1) a -> Proxy n -> a

-- | <i>O(1)</i> Indexing using an Int without bounds checking.
unsafeIndex :: forall v n a. (KnownNat n, Vector v a) => Vector v n a -> Int -> a

-- | <i>O(1)</i> Yield the first element of a non-empty vector.
head :: forall v n a. (Vector v a) => Vector v (n + 1) a -> a

-- | <i>O(1)</i> Yield the last element of a non-empty vector.
last :: forall v n a. (Vector v a) => Vector v (n + 1) a -> a

-- | <i>O(1)</i> Safe indexing in a monad. See the documentation for
--   <a>indexM</a> for an explanation of why this is useful.
indexM :: forall v n a m. (KnownNat n, Vector v a, Monad m) => Vector v n a -> Finite n -> m a

-- | <i>O(1)</i> Safe indexing in a monad using a <a>Proxy</a>. See the
--   documentation for <a>indexM</a> for an explanation of why this is
--   useful.
indexM' :: forall v n k a m. (KnownNat n, KnownNat k, Vector v a, Monad m) => Vector v (n + k) a -> Proxy n -> m a

-- | <i>O(1)</i> Indexing using an Int without bounds checking. See the
--   documentation for <a>indexM</a> for an explanation of why this is
--   useful.
unsafeIndexM :: forall v n a m. (KnownNat n, Vector v a, Monad m) => Vector v n a -> Int -> m a

-- | <i>O(1)</i> Yield the first element of a non-empty vector in a monad.
--   See the documentation for <a>indexM</a> for an explanation of why this
--   is useful.
headM :: forall v n a m. (KnownNat n, Vector v a, Monad m) => Vector v (n + 1) a -> m a

-- | <i>O(1)</i> Yield the last element of a non-empty vector in a monad.
--   See the documentation for <a>indexM</a> for an explanation of why this
--   is useful.
lastM :: forall v n a m. (KnownNat n, Vector v a, Monad m) => Vector v (n + 1) a -> m a

-- | <i>O(1)</i> Yield a slice of the vector without copying it with an
--   inferred length argument.
slice :: forall v i n a. (KnownNat i, KnownNat n, Vector v a) => Proxy i -> Vector v (i + n) a -> Vector v n a

-- | <i>O(1)</i> Yield a slice of the vector without copying it with an
--   explicit length argument.
slice' :: forall v i n a. (KnownNat i, KnownNat n, Vector v a) => Proxy i -> Proxy n -> Vector v (i + n) a -> Vector v n a

-- | <i>O(1)</i> Yield all but the last element of a non-empty vector
--   without copying.
init :: forall v n a. (Vector v a) => Vector v (n + 1) a -> Vector v n a

-- | <i>O(1)</i> Yield all but the first element of a non-empty vector
--   without copying.
tail :: forall v n a. (Vector v a) => Vector v (n + 1) a -> Vector v n a

-- | <i>O(1)</i> Yield the first n elements. The resultant vector always
--   contains this many elements. The length of the resultant vector is
--   inferred from the type.
take :: forall v n m a. (KnownNat n, KnownNat m, Vector v a) => Vector v (m + n) a -> Vector v n a

-- | <i>O(1)</i> Yield the first n elements. The resultant vector always
--   contains this many elements. The length of the resultant vector is
--   given explicitly as a <a>Proxy</a> argument.
take' :: forall v n m a. (KnownNat n, KnownNat m, Vector v a) => Proxy n -> Vector v (m + n) a -> Vector v n a

-- | <i>O(1)</i> Yield all but the the first n elements. The given vector
--   must contain at least this many elements The length of the resultant
--   vector is inferred from the type.
drop :: forall v n m a. (KnownNat n, KnownNat m, Vector v a) => Vector v (m + n) a -> Vector v m a

-- | <i>O(1)</i> Yield all but the the first n elements. The given vector
--   must contain at least this many elements The length of the resultant
--   vector is givel explicitly as a <a>Proxy</a> argument.
drop' :: forall v n m a. (KnownNat n, KnownNat m, Vector v a) => Proxy n -> Vector v (m + n) a -> Vector v m a

-- | <i>O(1)</i> Yield the first n elements paired with the remainder
--   without copying. The lengths of the resultant vector are inferred from
--   the type.
splitAt :: forall v n m a. (KnownNat n, KnownNat m, Vector v a) => Vector v (n + m) a -> (Vector v n a, Vector v m a)

-- | <i>O(1)</i> Yield the first n elements paired with the remainder
--   without copying. The length of the first resultant vector is passed
--   explicitly as a <a>Proxy</a> argument.
splitAt' :: forall v n m a. (KnownNat n, KnownNat m, Vector v a) => Proxy n -> Vector v (n + m) a -> (Vector v n a, Vector v m a)

-- | <i>O(1)</i> Empty vector.
empty :: forall v a. (Vector v a) => Vector v 0 a

-- | <i>O(1)</i> Vector with exactly one element.
singleton :: forall v a. (Vector v a) => a -> Vector v 1 a

-- | <i>O(n)</i> Construct a vector with the same element in each position
--   where the length is inferred from the type.
replicate :: forall v n a. (KnownNat n, Vector v a) => a -> Vector v n a

-- | <i>O(n)</i> Construct a vector with the same element in each position
--   where the length is given explicitly as a <a>Proxy</a> argument.
replicate' :: forall v n a. (KnownNat n, Vector v a) => Proxy n -> a -> Vector v n a

-- | <i>O(n)</i> 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. (KnownNat n, Vector v a) => (Int -> a) -> Vector v n a

-- | <i>O(n)</i> construct a vector of the given length by applying the
--   function to each index where the length is given explicitly as a
--   <a>Proxy</a> argument.
generate' :: forall v n a. (KnownNat n, Vector v a) => Proxy n -> (Int -> a) -> Vector v n a

-- | <i>O(n)</i> construct a vector of the given length by applying the
--   function to each index where the length is inferred from the type.
--   
--   The function can expect a <tt><a>Finite</a> n</tt>, meaning that its
--   input will always be between <tt>0</tt> and <tt>n - 1</tt>.
generate_ :: forall v n a. (KnownNat n, Vector v a) => (Finite n -> a) -> Vector v n a

-- | <i>O(n)</i> Apply function n times to value. Zeroth element is
--   original value. The length is inferred from the type.
iterateN :: forall v n a. (KnownNat n, Vector v a) => (a -> a) -> a -> Vector v n a

-- | <i>O(n)</i> Apply function n times to value. Zeroth element is
--   original value. The length is given explicitly as a <a>Proxy</a>
--   argument.
iterateN' :: forall v n a. (KnownNat n, Vector v a) => Proxy n -> (a -> a) -> a -> Vector v n a

-- | <i>O(n)</i> Execute the monadic action <tt>n</tt> times and store the
--   results in a vector where <tt>n</tt> is inferred from the type.
replicateM :: forall v n m a. (KnownNat n, Vector v a, Monad m) => m a -> m (Vector v n a)

-- | <i>O(n)</i> Execute the monadic action <tt>n</tt> times and store the
--   results in a vector where <tt>n</tt> is given explicitly as a
--   <a>Proxy</a> argument.
replicateM' :: forall v n m a. (KnownNat n, Vector v a, Monad m) => Proxy n -> m a -> m (Vector v n a)

-- | <i>O(n)</i> Construct a vector of length <tt>n</tt> by applying the
--   monadic action to each index where n is inferred from the type.
generateM :: forall v n m a. (KnownNat n, Vector v a, Monad m) => (Int -> m a) -> m (Vector v n a)

-- | <i>O(n)</i> Construct a vector of length <tt>n</tt> by applying the
--   monadic action to each index where n is given explicitly as a
--   <a>Proxy</a> argument.
generateM' :: forall v n m a. (KnownNat n, Vector v a, Monad m) => Proxy n -> (Int -> m a) -> m (Vector v n a)

-- | <i>O(n)</i> Construct a vector of length <tt>n</tt> by applying the
--   monadic action to each index where n is inferred from the type.
--   
--   The function can expect a <tt><a>Finite</a> n</tt>, meaning that its
--   input will always be between <tt>0</tt> and <tt>n - 1</tt>.
generateM_ :: forall v n m a. (KnownNat n, Vector v a, Monad m) => (Finite n -> m a) -> m (Vector v n a)

-- | <i>O(n)</i> Construct a vector with exactly <tt>n</tt> elements by
--   repeatedly applying the generator function to the a seed. The length,
--   <tt>n</tt>, is inferred from the type.
unfoldrN :: forall v n a b. (KnownNat n, Vector v a) => (b -> (a, b)) -> b -> Vector v n a

-- | <i>O(n)</i> Construct a vector with exactly <tt>n</tt> elements by
--   repeatedly applying the generator function to the a seed. The length,
--   <tt>n</tt>, is given explicitly as a <a>Proxy</a> argument.
unfoldrN' :: forall v n a b. (KnownNat n, Vector v a) => Proxy n -> (b -> (a, b)) -> b -> Vector v n a

-- | <i>O(n)</i> Yield a vector of length <tt>n</tt> containing the values
--   <tt>x</tt>, <tt>x+1</tt> etc. The length, <tt>n</tt>, is inferred from
--   the type.
enumFromN :: forall v n a. (KnownNat n, Vector v a, Num a) => a -> Vector v n a

-- | <i>O(n)</i> Yield a vector of length <tt>n</tt> containing the values
--   <tt>x</tt>, <tt>x+1</tt> etc. The length, <tt>n</tt>, is given
--   explicitly as a <a>Proxy</a> argument.
enumFromN' :: forall v n a. (KnownNat n, Vector v a, Num a) => a -> Proxy n -> Vector v n a

-- | <i>O(n)</i> Yield a vector of the given length containing the values
--   <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. The length, <tt>n</tt>,
--   is inferred from the type.
enumFromStepN :: forall v n a. (KnownNat n, Vector v a, Num a) => a -> a -> Vector v n a

-- | <i>O(n)</i> Yield a vector of the given length containing the values
--   <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. The length, <tt>n</tt>,
--   is given explicitly as a <a>Proxy</a> argument.
enumFromStepN' :: forall v n a. (KnownNat n, Vector v a, Num a) => a -> a -> Proxy n -> Vector v n a

-- | <i>O(n)</i> Prepend an element.
cons :: forall v n a. Vector v a => a -> Vector v n a -> Vector v (n + 1) a

-- | <i>O(n)</i> Append an element.
snoc :: forall v n a. Vector v a => Vector v n a -> a -> Vector v (n + 1) a

-- | <i>O(m+n)</i> Concatenate two vectors.
(++) :: forall v n m a. Vector v a => Vector v n a -> Vector v m a -> Vector v (n + m) a

-- | <i>O(n)</i> 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:
--   
--   <pre>
--   force (slice 0 2 &lt;huge vector&gt;)
--   </pre>
--   
--   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.
force :: Vector v a => Vector v n a -> Vector v n a

-- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the
--   vector element at position <tt>i</tt> by <tt>a</tt>.
--   
--   <pre>
--   &lt;5,9,2,7&gt; // [(2,1),(0,3),(2,8)] = &lt;3,9,8,7&gt;
--   </pre>
(//) :: (Vector v a) => Vector v m a -> [(Int, a)] -> Vector v m a

-- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the vector of
--   index/value pairs, replace the vector element at position <tt>i</tt>
--   by <tt>a</tt>.
--   
--   <pre>
--   update &lt;5,9,2,7&gt; &lt;(2,1),(0,3),(2,8)&gt; = &lt;3,9,8,7&gt;
--   </pre>
update :: (Vector v a, Vector v (Int, a)) => Vector v m a -> Vector v n (Int, a) -> Vector v m a

-- | <i>O(m+n)</i> For each index <tt>i</tt> from the index vector and the
--   corresponding value <tt>a</tt> from the value vector, replace the
--   element of the initial vector at position <tt>i</tt> by <tt>a</tt>.
--   
--   <pre>
--   update_ &lt;5,9,2,7&gt;  &lt;2,0,2&gt; &lt;1,3,8&gt; = &lt;3,9,8,7&gt;
--   </pre>
--   
--   This function is useful for instances of <a>Vector</a> that cannot
--   store pairs. Otherwise, <a>update</a> is probably more convenient.
--   
--   <pre>
--   update_ xs is ys = <a>update</a> xs (<a>zip</a> is ys)
--   </pre>
update_ :: (Vector v a, Vector v Int) => Vector v m a -> Vector v n Int -> Vector v n a -> Vector v m a

-- | Same as (<a>//</a>) but without bounds checking.
unsafeUpd :: (Vector v a) => Vector v m a -> [(Int, a)] -> Vector v m a

-- | Same as <a>update</a> but without bounds checking.
unsafeUpdate :: (Vector v a, Vector v (Int, a)) => Vector v m a -> Vector v n (Int, a) -> Vector v m a

-- | Same as <a>update_</a> but without bounds checking.
unsafeUpdate_ :: (Vector v a, Vector v Int) => Vector v m a -> Vector v n Int -> Vector v n a -> Vector v m a

-- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the
--   vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.
--   
--   <pre>
--   accum (+) &lt;5,9,2&gt; [(2,4),(1,6),(0,3),(1,7)] = &lt;5+3, 9+6+7, 2+4&gt;
--   </pre>
accum :: Vector v a => (a -> b -> a) -> Vector v m a -> [(Int, b)] -> Vector v m a

-- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the vector of pairs,
--   replace the vector element <tt>a</tt> at position <tt>i</tt> by <tt>f
--   a b</tt>.
--   
--   <pre>
--   accumulate (+) &lt;5,9,2&gt; &lt;(2,4),(1,6),(0,3),(1,7)&gt; = &lt;5+3, 9+6+7, 2+4&gt;
--   </pre>
accumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> Vector v m a -> Vector v n (Int, b) -> Vector v m a

-- | <i>O(m+n)</i> For each index <tt>i</tt> from the index vector and the
--   corresponding value <tt>b</tt> from the the value vector, replace the
--   element of the initial vector at position <tt>i</tt> by <tt>f a
--   b</tt>.
--   
--   <pre>
--   accumulate_ (+) &lt;5,9,2&gt; &lt;2,1,0,1&gt; &lt;4,6,3,7&gt; = &lt;5+3, 9+6+7, 2+4&gt;
--   </pre>
--   
--   This function is useful for instances of <a>Vector</a> that cannot
--   store pairs. Otherwise, <a>accumulate</a> is probably more convenient:
--   
--   <pre>
--   accumulate_ f as is bs = <a>accumulate</a> f as (<a>zip</a> is bs)
--   </pre>
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

-- | Same as <a>accum</a> but without bounds checking.
unsafeAccum :: Vector v a => (a -> b -> a) -> Vector v m a -> [(Int, b)] -> Vector v m a

-- | Same as <a>accumulate</a> but without bounds checking.
unsafeAccumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> Vector v m a -> Vector v n (Int, b) -> Vector v m a

-- | Same as <a>accumulate_</a> but without bounds checking.
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

-- | <i>O(n)</i> Reverse a vector
reverse :: (Vector v a) => Vector v n a -> Vector v n a

-- | <i>O(n)</i> Yield the vector obtained by replacing each element
--   <tt>i</tt> of the index vector by <tt>xs<tt>!</tt>i</tt>. This is
--   equivalent to <tt><a>map</a> (xs<tt>!</tt>) is</tt> but is often much
--   more efficient.
--   
--   <pre>
--   backpermute &lt;a,b,c,d&gt; &lt;0,3,2,3,1,0&gt; = &lt;a,d,c,d,b,a&gt;
--   </pre>
backpermute :: (Vector v a, Vector v Int) => Vector v m a -> Vector v n Int -> Vector v n a

-- | Same as <a>backpermute</a> but without bounds checking.
unsafeBackpermute :: (Vector v a, Vector v Int) => Vector v m a -> Vector v n Int -> Vector v n a

-- | <i>O(n)</i> Pair each element in a vector with its index
indexed :: (Vector v a, Vector v (Int, a)) => Vector v n a -> Vector v n (Int, a)

-- | <i>O(n)</i> Map a function over a vector
map :: (Vector v a, Vector v b) => (a -> b) -> Vector v n a -> Vector v n b

-- | <i>O(n)</i> Apply a function to every element of a vector and its
--   index
imap :: (Vector v a, Vector v b) => (Int -> a -> b) -> Vector v n a -> Vector v n b

-- | <i>O(n*m)</i> Map a function over a vector and concatenate the
--   results. The function is required to always return the same length
--   vector.
concatMap :: (Vector v a, Vector v b) => (a -> Vector v m b) -> Vector v n a -> Vector v (n * m) b

-- | <i>O(n)</i> Apply the monadic action to all elements of the vector,
--   yielding a vector of results
mapM :: (Monad m, Vector v a, Vector v b) => (a -> m b) -> Vector v n a -> m (Vector v n b)

-- | <i>O(n)</i> Apply the monadic action to every element of a vector and
--   its index, yielding a vector of results
imapM :: (Monad m, Vector v a, Vector v b) => (Int -> a -> m b) -> Vector v n a -> m (Vector v n b)

-- | <i>O(n)</i> Apply the monadic action to all elements of a vector and
--   ignore the results
mapM_ :: (Monad m, Vector v a) => (a -> m b) -> Vector v n a -> m ()

-- | <i>O(n)</i> Apply the monadic action to every element of a vector and
--   its index, ignoring the results
imapM_ :: (Monad m, Vector v a) => (Int -> a -> m b) -> Vector v n a -> m ()

-- | <i>O(n)</i> Apply the monadic action to all elements of the vector,
--   yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.
forM :: (Monad m, Vector v a, Vector v b) => Vector v n a -> (a -> m b) -> m (Vector v n b)

-- | <i>O(n)</i> Apply the monadic action to all elements of a vector and
--   ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.
forM_ :: (Monad m, Vector v a) => Vector v n a -> (a -> m b) -> m ()

-- | <i>O(n)</i> Zip two vectors of the same length with the given
--   function.
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

-- | Zip three vectors 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
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

-- | <i>O(n)</i> Zip two vectors of the same length with a function that
--   also takes the elements' indices).
izipWith :: (Vector v a, Vector v b, Vector v c) => (Int -> 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) => (Int -> 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) => (Int -> 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) => (Int -> 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) => (Int -> 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

-- | <i>O(n)</i> Zip two vectors of the same length
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)

-- | <i>O(n)</i> Zip the two vectors of the same length with the monadic
--   action and yield a vector of results
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)

-- | <i>O(n)</i> Zip the two vectors with a monadic action that also takes
--   the element index and yield a vector of results
izipWithM :: (Monad m, Vector v a, Vector v b, Vector v c) => (Int -> a -> b -> m c) -> Vector v n a -> Vector v n b -> m (Vector v n c)

-- | <i>O(n)</i> Zip the two vectors with the monadic action and ignore the
--   results
zipWithM_ :: (Monad m, Vector v a, Vector v b) => (a -> b -> m c) -> Vector v n a -> Vector v n b -> m ()

-- | <i>O(n)</i> Zip the two vectors with a monadic action that also takes
--   the element index and ignore the results
izipWithM_ :: (Monad m, Vector v a, Vector v b) => (Int -> a -> b -> m c) -> Vector v n a -> Vector v n b -> m ()

-- | <i>O(min(m,n))</i> Unzip a vector of pairs.
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)

-- | <i>O(n)</i> Check if the vector contains an element
elem :: (Vector v a, Eq a) => a -> Vector v n a -> Bool
infix 4 `elem`

-- | <i>O(n)</i> Check if the vector does not contain an element (inverse
--   of <a>elem</a>)
notElem :: (Vector v a, Eq a) => a -> Vector v n a -> Bool
infix 4 `notElem`

-- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate
--   or <a>Nothing</a> if no such element exists.
find :: Vector v a => (a -> Bool) -> Vector v n a -> Maybe a

-- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching
--   the predicate or <a>Nothing</a> if no such element exists.
findIndex :: Vector v a => (a -> Bool) -> Vector v n a -> Maybe Int

-- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the
--   given element or <a>Nothing</a> if the vector does not contain the
--   element. This is a specialised version of <a>findIndex</a>.
elemIndex :: (Vector v a, Eq a) => a -> Vector v n a -> Maybe Int

-- | <i>O(n)</i> Left fold
foldl :: Vector v b => (a -> b -> a) -> a -> Vector v n b -> a

-- | <i>O(n)</i> Left fold on non-empty vectors
foldl1 :: (Vector v a, KnownNat n) => (a -> a -> a) -> Vector v (n + 1) a -> a

-- | <i>O(n)</i> Left fold with strict accumulator
foldl' :: Vector v b => (a -> b -> a) -> a -> Vector v n b -> a

-- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator
foldl1' :: (Vector v a, KnownNat n) => (a -> a -> a) -> Vector v (n + 1) a -> a

-- | <i>O(n)</i> Right fold
foldr :: Vector v a => (a -> b -> b) -> b -> Vector v n a -> b

-- | <i>O(n)</i> Right fold on non-empty vectors
foldr1 :: (Vector v a, KnownNat n) => (a -> a -> a) -> Vector v (n + 1) a -> a

-- | <i>O(n)</i> Right fold with a strict accumulator
foldr' :: Vector v a => (a -> b -> b) -> b -> Vector v n a -> b

-- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator
foldr1' :: (Vector v a, KnownNat n) => (a -> a -> a) -> Vector v (n + 1) a -> a

-- | <i>O(n)</i> Left fold (function applied to each element and its index)
ifoldl :: Vector v b => (a -> Int -> b -> a) -> a -> Vector v n b -> a

-- | <i>O(n)</i> Left fold with strict accumulator (function applied to
--   each element and its index)
ifoldl' :: Vector v b => (a -> Int -> b -> a) -> a -> Vector v n b -> a

-- | <i>O(n)</i> Right fold (function applied to each element and its
--   index)
ifoldr :: Vector v a => (Int -> a -> b -> b) -> b -> Vector v n a -> b

-- | <i>O(n)</i> Right fold with strict accumulator (function applied to
--   each element and its index)
ifoldr' :: Vector v a => (Int -> a -> b -> b) -> b -> Vector v n a -> b

-- | <i>O(n)</i> Check if all elements satisfy the predicate.
all :: Vector v a => (a -> Bool) -> Vector v n a -> Bool

-- | <i>O(n)</i> Check if any element satisfies the predicate.
any :: Vector v a => (a -> Bool) -> Vector v n a -> Bool

-- | <i>O(n)</i> Check if all elements are <a>True</a>
and :: Vector v Bool => Vector v n Bool -> Bool

-- | <i>O(n)</i> Check if any element is <a>True</a>
or :: Vector v Bool => Vector v n Bool -> Bool

-- | <i>O(n)</i> Compute the sum of the elements
sum :: (Vector v a, Num a) => Vector v n a -> a

-- | <i>O(n)</i> Compute the produce of the elements
product :: (Vector v a, Num a) => Vector v n a -> a

-- | <i>O(n)</i> Yield the maximum element of the non-empty vector.
maximum :: (Vector v a, Ord a, KnownNat n) => Vector v (n + 1) a -> a

-- | <i>O(n)</i> Yield the maximum element of the non-empty vector
--   according to the given comparison function.
maximumBy :: (Vector v a, KnownNat n) => (a -> a -> Ordering) -> Vector v (n + 1) a -> a

-- | <i>O(n)</i> Yield the minimum element of the non-empty vector.
minimum :: (Vector v a, Ord a, KnownNat n) => Vector v (n + 1) a -> a

-- | <i>O(n)</i> Yield the minimum element of the non-empty vector
--   according to the given comparison function.
minimumBy :: (Vector v a, KnownNat n) => (a -> a -> Ordering) -> Vector v (n + 1) a -> a

-- | <i>O(n)</i> Yield the index of the maximum element of the non-empty
--   vector.
maxIndex :: (Vector v a, Ord a, KnownNat n) => Vector v (n + 1) a -> Int

-- | <i>O(n)</i> Yield the index of the maximum element of the non-empty
--   vector according to the given comparison function.
maxIndexBy :: (Vector v a, KnownNat n) => (a -> a -> Ordering) -> Vector v (n + 1) a -> Int

-- | <i>O(n)</i> Yield the index of the minimum element of the non-empty
--   vector.
minIndex :: (Vector v a, Ord a, KnownNat n) => Vector v (n + 1) a -> Int

-- | <i>O(n)</i> Yield the index of the minimum element of the non-empty
--   vector according to the given comparison function.
minIndexBy :: (Vector v a, KnownNat n) => (a -> a -> Ordering) -> Vector v (n + 1) a -> Int

-- | <i>O(n)</i> Monadic fold
foldM :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m a

-- | <i>O(n)</i> Monadic fold (action applied to each element and its
--   index)
ifoldM :: (Monad m, Vector v b) => (a -> Int -> b -> m a) -> a -> Vector v n b -> m a

-- | <i>O(n)</i> Monadic fold over non-empty vectors
fold1M :: (Monad m, Vector v a, KnownNat n) => (a -> a -> m a) -> Vector v (n + 1) a -> m a

-- | <i>O(n)</i> Monadic fold with strict accumulator
foldM' :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m a

-- | <i>O(n)</i> Monadic fold with strict accumulator (action applied to
--   each element and its index)
ifoldM' :: (Monad m, Vector v b) => (a -> Int -> b -> m a) -> a -> Vector v n b -> m a

-- | <i>O(n)</i> Monadic fold over non-empty vectors with strict
--   accumulator
fold1M' :: (Monad m, Vector v a, KnownNat n) => (a -> a -> m a) -> Vector v (n + 1) a -> m a

-- | <i>O(n)</i> Monadic fold that discards the result
foldM_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m ()

-- | <i>O(n)</i> Monadic fold that discards the result (action applied to
--   each element and its index)
ifoldM_ :: (Monad m, Vector v b) => (a -> Int -> b -> m a) -> a -> Vector v n b -> m ()

-- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the
--   result
fold1M_ :: (Monad m, Vector v a, KnownNat n) => (a -> a -> m a) -> Vector v (n + 1) a -> m ()

-- | <i>O(n)</i> Monadic fold with strict accumulator that discards the
--   result
foldM'_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> Vector v n b -> m ()

-- | <i>O(n)</i> Monadic fold with strict accumulator that discards the
--   result (action applied to each element and its index)
ifoldM'_ :: (Monad m, Vector v b) => (a -> Int -> b -> m a) -> a -> Vector v n b -> m ()

-- | <i>O(n)</i> Monad fold over non-empty vectors with strict accumulator
--   that discards the result
fold1M'_ :: (Monad m, Vector v a, KnownNat n) => (a -> a -> m a) -> Vector v (n + 1) a -> m ()

-- | Evaluate each action and collect the results
sequence :: (Monad m, Vector v a, Vector v (m a)) => Vector v n (m a) -> m (Vector v n a)

-- | Evaluate each action and discard the results
sequence_ :: (Monad m, Vector v (m a)) => Vector v n (m a) -> m ()

-- | <i>O(n)</i> Prescan
--   
--   <pre>
--   prescanl f z = <a>init</a> . <a>scanl</a> f z
--   </pre>
--   
--   Example: <tt>prescanl (+) 0 &lt;1,2,3,4&gt; = &lt;0,1,3,6&gt;</tt>
prescanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a

-- | <i>O(n)</i> Prescan with strict accumulator
prescanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a

-- | <i>O(n)</i> Scan
postscanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a

-- | <i>O(n)</i> Scan with strict accumulator
postscanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a

-- | <i>O(n)</i> Haskell-style scan
scanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a

-- | <i>O(n)</i> Haskell-style scan with strict accumulator
scanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> Vector v n b -> Vector v n a

-- | <i>O(n)</i> Scan over a non-empty vector
scanl1 :: (Vector v a, KnownNat n) => (a -> a -> a) -> Vector v (n + 1) a -> Vector v (n + 1) a

-- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator
scanl1' :: (Vector v a, KnownNat n) => (a -> a -> a) -> Vector v (n + 1) a -> Vector v (n + 1) a

-- | <i>O(n)</i> Right-to-left prescan
prescanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b

-- | <i>O(n)</i> Right-to-left prescan with strict accumulator
prescanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b

-- | <i>O(n)</i> Right-to-left scan
postscanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b

-- | <i>O(n)</i> Right-to-left scan with strict accumulator
postscanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b

-- | <i>O(n)</i> Right-to-left Haskell-style scan
scanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b

-- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator
scanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> Vector v n a -> Vector v n b

-- | <i>O(n)</i> Right-to-left scan over a non-empty vector
scanr1 :: (Vector v a, KnownNat n) => (a -> a -> a) -> Vector v (n + 1) a -> Vector v (n + 1) a

-- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict
--   accumulator
scanr1' :: (Vector v a, KnownNat n) => (a -> a -> a) -> Vector v (n + 1) a -> Vector v (n + 1) a

-- | <i>O(n)</i> Convert a vector to a list
toList :: Vector v a => Vector v n a -> [a]

-- | <i>O(n)</i> Convert a list to a vector
fromList :: (Vector v a, KnownNat n) => [a] -> Maybe (Vector v n a)

-- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a
--   vector. The length of the resultant vector is inferred from the type.
fromListN :: forall v n a. (Vector v a, KnownNat n) => [a] -> Maybe (Vector v n a)

-- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a
--   vector. The length of the resultant vector is given explicitly as a
--   <a>Proxy</a> argument.
fromListN' :: forall v n a. (Vector v a, KnownNat n) => Proxy n -> [a] -> Maybe (Vector v n a)

-- | <i>O(n)</i> 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 <a>withSized</a>
withSizedList :: forall v a r. Vector v a => [a] -> (forall n. KnownNat n => Vector v n a -> r) -> r

-- | <i>O(n)</i> Convert different vector types
convert :: (Vector v a, Vector w a) => Vector v n a -> Vector w n a

-- | Convert a <a>Vector</a> into a <a>Vector</a> if it has the correct
--   size, otherwise return Nothing.
toSized :: forall v n a. (Vector v a, KnownNat n) => v a -> Maybe (Vector v n a)

-- | Takes a <a>Vector</a> and returns a continuation providing a
--   <a>Sized</a> with a size parameter <tt>n</tt> that is determined at
--   runtime based on the length of the input vector.
--   
--   Essentially converts a <a>Vector</a> into a <a>Vector</a> with the
--   correct size parameter <tt>n</tt>.
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

-- | Apply a function on unsized vectors to a sized vector. The function
--   must preserve the size of the vector, this is not checked.
withVectorUnsafe :: forall a b v w (n :: Nat). (Vector v a, Vector w b) => (v a -> w b) -> Vector v n a -> Vector w n b
instance (Data.Data.Data (v a), Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable v, GHC.TypeLits.KnownNat n) => Data.Data.Data (Data.Vector.Generic.Sized.Vector v n a)
instance GHC.Generics.Generic (Data.Vector.Generic.Sized.Vector v n a)
instance Control.DeepSeq.NFData (v a) => Control.DeepSeq.NFData (Data.Vector.Generic.Sized.Vector v n a)
instance Data.Traversable.Traversable v => Data.Traversable.Traversable (Data.Vector.Generic.Sized.Vector v n)
instance Data.Foldable.Foldable v => Data.Foldable.Foldable (Data.Vector.Generic.Sized.Vector v n)
instance GHC.Base.Functor v => GHC.Base.Functor (Data.Vector.Generic.Sized.Vector v n)
instance GHC.Classes.Ord (v a) => GHC.Classes.Ord (Data.Vector.Generic.Sized.Vector v n a)
instance GHC.Classes.Eq (v a) => GHC.Classes.Eq (Data.Vector.Generic.Sized.Vector v n a)
instance GHC.Show.Show (v a) => GHC.Show.Show (Data.Vector.Generic.Sized.Vector v n a)
instance (GHC.TypeLits.KnownNat n, Foreign.Storable.Storable a, Data.Vector.Generic.Base.Vector v a) => Foreign.Storable.Storable (Data.Vector.Generic.Sized.Vector v n a)
instance GHC.TypeLits.KnownNat n => GHC.Base.Applicative (Data.Vector.Generic.Sized.Vector Data.Vector.Vector n)
instance (GHC.Base.Monoid m, Data.Vector.Generic.Base.Vector v m, GHC.TypeLits.KnownNat n) => GHC.Base.Monoid (Data.Vector.Generic.Sized.Vector v n m)
instance Data.Vector.Generic.Base.Vector v m => GHC.Base.Monoid (Data.Vector.Generic.Sized.Vector v 0 m)


-- | This module re-exports the functionality in <a>Sized</a> specialized
--   to <a>Vector</a>.
--   
--   Functions returning a vector determine the size from the type context
--   unless they have a <tt>'</tt> suffix in which case they take an
--   explicit <a>Proxy</a> argument.
--   
--   Functions where the resultant vector size is not know until compile
--   time are not exported.
module Data.Vector.Sized

-- | <a>Vector</a> specialized to use <a>Vector</a>
type Vector = Vector Vector

-- | <i>O(1)</i> Yield the length of the vector as an <a>Int</a>.
length :: forall n a. KnownNat n => Vector n a -> Int

-- | <i>O(1)</i> Yield the length of the vector as a <a>Proxy</a>.
length' :: forall n a. KnownNat n => Vector n a -> Proxy n

-- | <i>O(1)</i> Safe indexing using a <a>Finite</a>.
index :: forall n a. KnownNat n => Vector n a -> Finite n -> a

-- | <i>O(1)</i> Safe indexing using a <a>Proxy</a>.
index' :: forall n m a. (KnownNat n, KnownNat m) => Vector ((n + m) + 1) a -> Proxy n -> a

-- | <i>O(1)</i> Indexing using an Int without bounds checking.
unsafeIndex :: forall n a. KnownNat n => Vector n a -> Int -> a

-- | <i>O(1)</i> Yield the first element of a non-empty vector.
head :: forall n a. Vector (n + 1) a -> a

-- | <i>O(1)</i> Yield the last element of a non-empty vector.
last :: forall n a. Vector (n + 1) a -> a

-- | <i>O(1)</i> Safe indexing in a monad. See the documentation for
--   <a>indexM</a> for an explanation of why this is useful.
indexM :: forall n a m. (KnownNat n, Monad m) => Vector n a -> Finite n -> m a

-- | <i>O(1)</i> Safe indexing in a monad using a <a>Proxy</a>. See the
--   documentation for <a>indexM</a> for an explanation of why this is
--   useful.
indexM' :: forall n k a m. (KnownNat n, KnownNat k, Monad m) => Vector (n + k) a -> Proxy n -> m a

-- | <i>O(1)</i> Indexing using an Int without bounds checking. See the
--   documentation for <a>indexM</a> for an explanation of why this is
--   useful.
unsafeIndexM :: forall n a m. (KnownNat n, Monad m) => Vector n a -> Int -> m a

-- | <i>O(1)</i> Yield the first element of a non-empty vector in a monad.
--   See the documentation for <a>indexM</a> for an explanation of why this
--   is useful.
headM :: forall n a m. (KnownNat n, Monad m) => Vector (n + 1) a -> m a

-- | <i>O(1)</i> Yield the last element of a non-empty vector in a monad.
--   See the documentation for <a>indexM</a> for an explanation of why this
--   is useful.
lastM :: forall n a m. (KnownNat n, Monad m) => Vector (n + 1) a -> m a

-- | <i>O(1)</i> Yield a slice of the vector without copying it with an
--   inferred length argument.
slice :: forall i n a. (KnownNat i, KnownNat n) => Proxy i -> Vector (i + n) a -> Vector n a

-- | <i>O(1)</i> Yield a slice of the vector without copying it with an
--   explicit length argument.
slice' :: forall i n a. (KnownNat i, KnownNat n) => Proxy i -> Proxy n -> Vector (i + n) a -> Vector n a

-- | <i>O(1)</i> Yield all but the last element of a non-empty vector
--   without copying.
init :: forall n a. Vector (n + 1) a -> Vector n a

-- | <i>O(1)</i> Yield all but the first element of a non-empty vector
--   without copying.
tail :: forall n a. Vector (n + 1) a -> Vector n a

-- | <i>O(1)</i> Yield the first n elements. The resultant vector always
--   contains this many elements. The length of the resultant vector is
--   inferred from the type.
take :: forall n m a. (KnownNat n, KnownNat m) => Vector (m + n) a -> Vector n a

-- | <i>O(1)</i> Yield the first n elements. The resultant vector always
--   contains this many elements. The length of the resultant vector is
--   given explicitly as a <a>Proxy</a> argument.
take' :: forall n m a. (KnownNat n, KnownNat m) => Proxy n -> Vector (m + n) a -> Vector n a

-- | <i>O(1)</i> Yield all but the the first n elements. The given vector
--   must contain at least this many elements The length of the resultant
--   vector is inferred from the type.
drop :: forall n m a. (KnownNat n, KnownNat m) => Vector (m + n) a -> Vector m a

-- | <i>O(1)</i> Yield all but the the first n elements. The given vector
--   must contain at least this many elements The length of the resultant
--   vector is givel explicitly as a <a>Proxy</a> argument.
drop' :: forall n m a. (KnownNat n, KnownNat m) => Proxy n -> Vector (m + n) a -> Vector m a

-- | <i>O(1)</i> Yield the first n elements paired with the remainder
--   without copying. The lengths of the resultant vector are inferred from
--   the type.
splitAt :: forall n m a. (KnownNat n, KnownNat m) => Vector (n + m) a -> (Vector n a, Vector m a)

-- | <i>O(1)</i> Yield the first n elements paired with the remainder
--   without copying. The length of the first resultant vector is passed
--   explicitly as a <a>Proxy</a> argument.
splitAt' :: forall n m a. (KnownNat n, KnownNat m) => Proxy n -> Vector (n + m) a -> (Vector n a, Vector m a)

-- | <i>O(1)</i> Empty vector.
empty :: forall a. Vector 0 a

-- | <i>O(1)</i> Vector with exactly one element.
singleton :: forall a. a -> Vector 1 a

-- | <i>O(n)</i> Construct a vector with the same element in each position
--   where the length is inferred from the type.
replicate :: forall n a. KnownNat n => a -> Vector n a

-- | <i>O(n)</i> Construct a vector with the same element in each position
--   where the length is given explicitly as a <a>Proxy</a> argument.
replicate' :: forall n a. KnownNat n => Proxy n -> a -> Vector n a

-- | <i>O(n)</i> construct a vector of the given length by applying the
--   function to each index where the length is inferred from the type.
generate :: forall n a. KnownNat n => (Int -> a) -> Vector n a

-- | <i>O(n)</i> construct a vector of the given length by applying the
--   function to each index where the length is given explicitly as a
--   <a>Proxy</a> argument.
generate' :: forall n a. KnownNat n => Proxy n -> (Int -> a) -> Vector n a

-- | <i>O(n)</i> construct a vector of the given length by applying the
--   function to each index where the length is inferred from the type.
--   
--   The function can expect a <tt><a>Finite</a> n</tt>, meaning that its
--   input will always be between <tt>0</tt> and <tt>n - 1</tt>.
generate_ :: forall n a. KnownNat n => (Finite n -> a) -> Vector n a

-- | <i>O(n)</i> Apply function n times to value. Zeroth element is
--   original value. The length is inferred from the type.
iterateN :: forall n a. KnownNat n => (a -> a) -> a -> Vector n a

-- | <i>O(n)</i> Apply function n times to value. Zeroth element is
--   original value. The length is given explicitly as a <a>Proxy</a>
--   argument.
iterateN' :: forall n a. KnownNat n => Proxy n -> (a -> a) -> a -> Vector n a

-- | <i>O(n)</i> Execute the monadic action <tt>n</tt> times and store the
--   results in a vector where <tt>n</tt> is inferred from the type.
replicateM :: forall n m a. (KnownNat n, Monad m) => m a -> m (Vector n a)

-- | <i>O(n)</i> Execute the monadic action <tt>n</tt> times and store the
--   results in a vector where <tt>n</tt> is given explicitly as a
--   <a>Proxy</a> argument.
replicateM' :: forall n m a. (KnownNat n, Monad m) => Proxy n -> m a -> m (Vector n a)

-- | <i>O(n)</i> Construct a vector of length <tt>n</tt> by applying the
--   monadic action to each index where n is inferred from the type.
generateM :: forall n m a. (KnownNat n, Monad m) => (Int -> m a) -> m (Vector n a)

-- | <i>O(n)</i> Construct a vector of length <tt>n</tt> by applying the
--   monadic action to each index where n is given explicitly as a
--   <a>Proxy</a> argument.
generateM' :: forall n m a. (KnownNat n, Monad m) => Proxy n -> (Int -> m a) -> m (Vector n a)

-- | <i>O(n)</i> Construct a vector of length <tt>n</tt> by applying the
--   monadic action to each index where n is inferred from the type.
--   
--   The function can expect a <tt><a>Finite</a> n</tt>, meaning that its
--   input will always be between <tt>0</tt> and <tt>n - 1</tt>.
generateM_ :: forall n m a. (KnownNat n, Monad m) => (Finite n -> m a) -> m (Vector n a)

-- | <i>O(n)</i> Construct a vector with exactly <tt>n</tt> elements by
--   repeatedly applying the generator function to the a seed. The length,
--   <tt>n</tt>, is inferred from the type.
unfoldrN :: forall n a b. KnownNat n => (b -> (a, b)) -> b -> Vector n a

-- | <i>O(n)</i> Construct a vector with exactly <tt>n</tt> elements by
--   repeatedly applying the generator function to the a seed. The length,
--   <tt>n</tt>, is given explicitly as a <a>Proxy</a> argument.
unfoldrN' :: forall n a b. KnownNat n => Proxy n -> (b -> (a, b)) -> b -> Vector n a

-- | <i>O(n)</i> Yield a vector of length <tt>n</tt> containing the values
--   <tt>x</tt>, <tt>x+1</tt> etc. The length, <tt>n</tt>, is inferred from
--   the type.
enumFromN :: forall n a. (KnownNat n, Num a) => a -> Vector n a

-- | <i>O(n)</i> Yield a vector of length <tt>n</tt> containing the values
--   <tt>x</tt>, <tt>x+1</tt> etc. The length, <tt>n</tt>, is given
--   explicitly as a <a>Proxy</a> argument.
enumFromN' :: forall n a. (KnownNat n, Num a) => a -> Proxy n -> Vector n a

-- | <i>O(n)</i> Yield a vector of the given length containing the values
--   <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. The length, <tt>n</tt>,
--   is inferred from the type.
enumFromStepN :: forall n a. (KnownNat n, Num a) => a -> a -> Vector n a

-- | <i>O(n)</i> Yield a vector of the given length containing the values
--   <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. The length, <tt>n</tt>,
--   is given explicitly as a <a>Proxy</a> argument.
enumFromStepN' :: forall n a. (KnownNat n, Num a) => a -> a -> Proxy n -> Vector n a

-- | <i>O(n)</i> Prepend an element.
cons :: forall n a. a -> Vector n a -> Vector (n + 1) a

-- | <i>O(n)</i> Append an element.
snoc :: forall n a. Vector n a -> a -> Vector (n + 1) a

-- | <i>O(m+n)</i> Concatenate two vectors.
(++) :: forall n m a. Vector n a -> Vector m a -> Vector (n + m) a

-- | <i>O(n)</i> 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:
--   
--   <pre>
--   force (slice 0 2 &lt;huge vector&gt;)
--   </pre>
--   
--   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.
force :: Vector n a -> Vector n a

-- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the
--   vector element at position <tt>i</tt> by <tt>a</tt>.
--   
--   <pre>
--   &lt;5,9,2,7&gt; // [(2,1),(0,3),(2,8)] = &lt;3,9,8,7&gt;
--   </pre>
(//) :: Vector m a -> [(Int, a)] -> Vector m a

-- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the vector of
--   index/value pairs, replace the vector element at position <tt>i</tt>
--   by <tt>a</tt>.
--   
--   <pre>
--   update &lt;5,9,2,7&gt; &lt;(2,1),(0,3),(2,8)&gt; = &lt;3,9,8,7&gt;
--   </pre>
update :: Vector m a -> Vector n (Int, a) -> Vector m a

-- | <i>O(m+n)</i> For each index <tt>i</tt> from the index vector and the
--   corresponding value <tt>a</tt> from the value vector, replace the
--   element of the initial vector at position <tt>i</tt> by <tt>a</tt>.
--   
--   <pre>
--   update_ &lt;5,9,2,7&gt;  &lt;2,0,2&gt; &lt;1,3,8&gt; = &lt;3,9,8,7&gt;
--   </pre>
--   
--   This function is useful for instances of <a>Vector</a> that cannot
--   store pairs. Otherwise, <a>update</a> is probably more convenient.
--   
--   <pre>
--   update_ xs is ys = <a>update</a> xs (<a>zip</a> is ys)
--   </pre>
update_ :: Vector m a -> Vector n Int -> Vector n a -> Vector m a

-- | Same as (<a>//</a>) but without bounds checking.
unsafeUpd :: Vector m a -> [(Int, a)] -> Vector m a

-- | Same as <a>update</a> but without bounds checking.
unsafeUpdate :: Vector m a -> Vector n (Int, a) -> Vector m a

-- | Same as <a>update_</a> but without bounds checking.
unsafeUpdate_ :: Vector m a -> Vector n Int -> Vector n a -> Vector m a

-- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the
--   vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.
--   
--   <pre>
--   accum (+) &lt;5,9,2&gt; [(2,4),(1,6),(0,3),(1,7)] = &lt;5+3, 9+6+7, 2+4&gt;
--   </pre>
accum :: (a -> b -> a) -> Vector m a -> [(Int, b)] -> Vector m a

-- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the vector of pairs,
--   replace the vector element <tt>a</tt> at position <tt>i</tt> by <tt>f
--   a b</tt>.
--   
--   <pre>
--   accumulate (+) &lt;5,9,2&gt; &lt;(2,4),(1,6),(0,3),(1,7)&gt; = &lt;5+3, 9+6+7, 2+4&gt;
--   </pre>
accumulate :: (a -> b -> a) -> Vector m a -> Vector n (Int, b) -> Vector m a

-- | <i>O(m+n)</i> For each index <tt>i</tt> from the index vector and the
--   corresponding value <tt>b</tt> from the the value vector, replace the
--   element of the initial vector at position <tt>i</tt> by <tt>f a
--   b</tt>.
--   
--   <pre>
--   accumulate_ (+) &lt;5,9,2&gt; &lt;2,1,0,1&gt; &lt;4,6,3,7&gt; = &lt;5+3, 9+6+7, 2+4&gt;
--   </pre>
--   
--   This function is useful for instances of <a>Vector</a> that cannot
--   store pairs. Otherwise, <a>accumulate</a> is probably more convenient:
--   
--   <pre>
--   accumulate_ f as is bs = <a>accumulate</a> f as (<a>zip</a> is bs)
--   </pre>
accumulate_ :: (a -> b -> a) -> Vector m a -> Vector n Int -> Vector n b -> Vector m a

-- | Same as <a>accum</a> but without bounds checking.
unsafeAccum :: (a -> b -> a) -> Vector m a -> [(Int, b)] -> Vector m a

-- | Same as <a>accumulate</a> but without bounds checking.
unsafeAccumulate :: (a -> b -> a) -> Vector m a -> Vector n (Int, b) -> Vector m a

-- | Same as <a>accumulate_</a> but without bounds checking.
unsafeAccumulate_ :: (a -> b -> a) -> Vector m a -> Vector n Int -> Vector n b -> Vector m a

-- | <i>O(n)</i> Reverse a vector
reverse :: Vector n a -> Vector n a

-- | <i>O(n)</i> Yield the vector obtained by replacing each element
--   <tt>i</tt> of the index vector by <tt>xs<tt>!</tt>i</tt>. This is
--   equivalent to <tt><a>map</a> (xs<tt>!</tt>) is</tt> but is often much
--   more efficient.
--   
--   <pre>
--   backpermute &lt;a,b,c,d&gt; &lt;0,3,2,3,1,0&gt; = &lt;a,d,c,d,b,a&gt;
--   </pre>
backpermute :: Vector m a -> Vector n Int -> Vector n a

-- | Same as <a>backpermute</a> but without bounds checking.
unsafeBackpermute :: Vector m a -> Vector n Int -> Vector n a

-- | <i>O(n)</i> Pair each element in a vector with its index
indexed :: Vector n a -> Vector n (Int, a)

-- | <i>O(n)</i> Map a function over a vector
map :: (a -> b) -> Vector n a -> Vector n b

-- | <i>O(n)</i> Apply a function to every element of a vector and its
--   index
imap :: (Int -> a -> b) -> Vector n a -> Vector n b

-- | <i>O(n*m)</i> Map a function over a vector and concatenate the
--   results. The function is required to always return the same length
--   vector.
concatMap :: (a -> Vector m b) -> Vector n a -> Vector (n * m) b

-- | <i>O(n)</i> Apply the monadic action to all elements of the vector,
--   yielding a vector of results
mapM :: Monad m => (a -> m b) -> Vector n a -> m (Vector n b)

-- | <i>O(n)</i> Apply the monadic action to every element of a vector and
--   its index, yielding a vector of results
imapM :: Monad m => (Int -> a -> m b) -> Vector n a -> m (Vector n b)

-- | <i>O(n)</i> Apply the monadic action to all elements of a vector and
--   ignore the results
mapM_ :: Monad m => (a -> m b) -> Vector n a -> m ()

-- | <i>O(n)</i> Apply the monadic action to every element of a vector and
--   its index, ignoring the results
imapM_ :: Monad m => (Int -> a -> m b) -> Vector n a -> m ()

-- | <i>O(n)</i> Apply the monadic action to all elements of the vector,
--   yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.
forM :: Monad m => Vector n a -> (a -> m b) -> m (Vector n b)

-- | <i>O(n)</i> Apply the monadic action to all elements of a vector and
--   ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.
forM_ :: Monad m => Vector n a -> (a -> m b) -> m ()

-- | <i>O(n)</i> Zip two vectors of the same length with the given
--   function.
zipWith :: (a -> b -> c) -> Vector n a -> Vector n b -> Vector n c

-- | Zip three vectors with the given function.
zipWith3 :: (a -> b -> c -> d) -> Vector n a -> Vector n b -> Vector n c -> Vector n d
zipWith4 :: (a -> b -> c -> d -> e) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e
zipWith5 :: (a -> b -> c -> d -> e -> f) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f
zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f -> Vector n g

-- | <i>O(n)</i> Zip two vectors of the same length with a function that
--   also takes the elements' indices).
izipWith :: (Int -> a -> b -> c) -> Vector n a -> Vector n b -> Vector n c
izipWith3 :: (Int -> a -> b -> c -> d) -> Vector n a -> Vector n b -> Vector n c -> Vector n d
izipWith4 :: (Int -> a -> b -> c -> d -> e) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e
izipWith5 :: (Int -> a -> b -> c -> d -> e -> f) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f
izipWith6 :: (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f -> Vector n g

-- | <i>O(n)</i> Zip two vectors of the same length
zip :: Vector n a -> Vector n b -> Vector n (a, b)
zip3 :: Vector n a -> Vector n b -> Vector n c -> Vector n (a, b, c)
zip4 :: Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n (a, b, c, d)
zip5 :: Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n (a, b, c, d, e)
zip6 :: Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f -> Vector n (a, b, c, d, e, f)

-- | <i>O(n)</i> Zip the two vectors of the same length with the monadic
--   action and yield a vector of results
zipWithM :: Monad m => (a -> b -> m c) -> Vector n a -> Vector n b -> m (Vector n c)

-- | <i>O(n)</i> Zip the two vectors with a monadic action that also takes
--   the element index and yield a vector of results
izipWithM :: Monad m => (Int -> a -> b -> m c) -> Vector n a -> Vector n b -> m (Vector n c)

-- | <i>O(n)</i> Zip the two vectors with the monadic action and ignore the
--   results
zipWithM_ :: Monad m => (a -> b -> m c) -> Vector n a -> Vector n b -> m ()

-- | <i>O(n)</i> Zip the two vectors with a monadic action that also takes
--   the element index and ignore the results
izipWithM_ :: Monad m => (Int -> a -> b -> m c) -> Vector n a -> Vector n b -> m ()

-- | <i>O(min(m,n))</i> Unzip a vector of pairs.
unzip :: Vector n (a, b) -> (Vector n a, Vector n b)
unzip3 :: Vector n (a, b, c) -> (Vector n a, Vector n b, Vector n c)
unzip4 :: Vector n (a, b, c, d) -> (Vector n a, Vector n b, Vector n c, Vector n d)
unzip5 :: Vector n (a, b, c, d, e) -> (Vector n a, Vector n b, Vector n c, Vector n d, Vector n e)
unzip6 :: Vector n (a, b, c, d, e, f) -> (Vector n a, Vector n b, Vector n c, Vector n d, Vector n e, Vector n f)

-- | <i>O(n)</i> Check if the vector contains an element
elem :: Eq a => a -> Vector n a -> Bool
infix 4 `elem`

-- | <i>O(n)</i> Check if the vector does not contain an element (inverse
--   of <a>elem</a>)
notElem :: Eq a => a -> Vector n a -> Bool
infix 4 `notElem`

-- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate
--   or <a>Nothing</a> if no such element exists.
find :: (a -> Bool) -> Vector n a -> Maybe a

-- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching
--   the predicate or <a>Nothing</a> if no such element exists.
findIndex :: (a -> Bool) -> Vector n a -> Maybe Int

-- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the
--   given element or <a>Nothing</a> if the vector does not contain the
--   element. This is a specialised version of <a>findIndex</a>.
elemIndex :: (Eq a) => a -> Vector n a -> Maybe Int

-- | <i>O(n)</i> Left fold
foldl :: (a -> b -> a) -> a -> Vector n b -> a

-- | <i>O(n)</i> Left fold on non-empty vectors
foldl1 :: KnownNat n => (a -> a -> a) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Left fold with strict accumulator
foldl' :: (a -> b -> a) -> a -> Vector n b -> a

-- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator
foldl1' :: KnownNat n => (a -> a -> a) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Right fold
foldr :: (a -> b -> b) -> b -> Vector n a -> b

-- | <i>O(n)</i> Right fold on non-empty vectors
foldr1 :: KnownNat n => (a -> a -> a) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Right fold with a strict accumulator
foldr' :: (a -> b -> b) -> b -> Vector n a -> b

-- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator
foldr1' :: KnownNat n => (a -> a -> a) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Left fold (function applied to each element and its index)
ifoldl :: (a -> Int -> b -> a) -> a -> Vector n b -> a

-- | <i>O(n)</i> Left fold with strict accumulator (function applied to
--   each element and its index)
ifoldl' :: (a -> Int -> b -> a) -> a -> Vector n b -> a

-- | <i>O(n)</i> Right fold (function applied to each element and its
--   index)
ifoldr :: (Int -> a -> b -> b) -> b -> Vector n a -> b

-- | <i>O(n)</i> Right fold with strict accumulator (function applied to
--   each element and its index)
ifoldr' :: (Int -> a -> b -> b) -> b -> Vector n a -> b

-- | <i>O(n)</i> Check if all elements satisfy the predicate.
all :: (a -> Bool) -> Vector n a -> Bool

-- | <i>O(n)</i> Check if any element satisfies the predicate.
any :: (a -> Bool) -> Vector n a -> Bool

-- | <i>O(n)</i> Check if all elements are <a>True</a>
and :: Vector n Bool -> Bool

-- | <i>O(n)</i> Check if any element is <a>True</a>
or :: Vector n Bool -> Bool

-- | <i>O(n)</i> Compute the sum of the elements
sum :: (Num a) => Vector n a -> a

-- | <i>O(n)</i> Compute the produce of the elements
product :: (Num a) => Vector n a -> a

-- | <i>O(n)</i> Yield the maximum element of the non-empty vector.
maximum :: (Ord a, KnownNat n) => Vector (n + 1) a -> a

-- | <i>O(n)</i> Yield the maximum element of the non-empty vector
--   according to the given comparison function.
maximumBy :: KnownNat n => (a -> a -> Ordering) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Yield the minimum element of the non-empty vector.
minimum :: (Ord a, KnownNat n) => Vector (n + 1) a -> a

-- | <i>O(n)</i> Yield the minimum element of the non-empty vector
--   according to the given comparison function.
minimumBy :: KnownNat n => (a -> a -> Ordering) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Yield the index of the maximum element of the non-empty
--   vector.
maxIndex :: (Ord a, KnownNat n) => Vector (n + 1) a -> Int

-- | <i>O(n)</i> Yield the index of the maximum element of the non-empty
--   vector according to the given comparison function.
maxIndexBy :: KnownNat n => (a -> a -> Ordering) -> Vector (n + 1) a -> Int

-- | <i>O(n)</i> Yield the index of the minimum element of the non-empty
--   vector.
minIndex :: (Ord a, KnownNat n) => Vector (n + 1) a -> Int

-- | <i>O(n)</i> Yield the index of the minimum element of the non-empty
--   vector according to the given comparison function.
minIndexBy :: KnownNat n => (a -> a -> Ordering) -> Vector (n + 1) a -> Int

-- | <i>O(n)</i> Monadic fold
foldM :: Monad m => (a -> b -> m a) -> a -> Vector n b -> m a

-- | <i>O(n)</i> Monadic fold (action applied to each element and its
--   index)
ifoldM :: Monad m => (a -> Int -> b -> m a) -> a -> Vector n b -> m a

-- | <i>O(n)</i> Monadic fold over non-empty vectors
fold1M :: (Monad m, KnownNat n) => (a -> a -> m a) -> Vector (n + 1) a -> m a

-- | <i>O(n)</i> Monadic fold with strict accumulator
foldM' :: Monad m => (a -> b -> m a) -> a -> Vector n b -> m a

-- | <i>O(n)</i> Monadic fold with strict accumulator (action applied to
--   each element and its index)
ifoldM' :: Monad m => (a -> Int -> b -> m a) -> a -> Vector n b -> m a

-- | <i>O(n)</i> Monadic fold over non-empty vectors with strict
--   accumulator
fold1M' :: (Monad m, KnownNat n) => (a -> a -> m a) -> Vector (n + 1) a -> m a

-- | <i>O(n)</i> Monadic fold that discards the result
foldM_ :: Monad m => (a -> b -> m a) -> a -> Vector n b -> m ()

-- | <i>O(n)</i> Monadic fold that discards the result (action applied to
--   each element and its index)
ifoldM_ :: Monad m => (a -> Int -> b -> m a) -> a -> Vector n b -> m ()

-- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the
--   result
fold1M_ :: (Monad m, KnownNat n) => (a -> a -> m a) -> Vector (n + 1) a -> m ()

-- | <i>O(n)</i> Monadic fold with strict accumulator that discards the
--   result
foldM'_ :: Monad m => (a -> b -> m a) -> a -> Vector n b -> m ()

-- | <i>O(n)</i> Monadic fold with strict accumulator that discards the
--   result (action applied to each element and its index)
ifoldM'_ :: Monad m => (a -> Int -> b -> m a) -> a -> Vector n b -> m ()

-- | <i>O(n)</i> Monad fold over non-empty vectors with strict accumulator
--   that discards the result
fold1M'_ :: (Monad m, KnownNat n) => (a -> a -> m a) -> Vector (n + 1) a -> m ()

-- | Evaluate each action and collect the results
sequence :: Monad m => Vector n (m a) -> m (Vector n a)

-- | Evaluate each action and discard the results
sequence_ :: Monad m => Vector n (m a) -> m ()

-- | <i>O(n)</i> Prescan
--   
--   <pre>
--   prescanl f z = <a>init</a> . <a>scanl</a> f z
--   </pre>
--   
--   Example: <tt>prescanl (+) 0 &lt;1,2,3,4&gt; = &lt;0,1,3,6&gt;</tt>
prescanl :: (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Prescan with strict accumulator
prescanl' :: (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Scan
postscanl :: (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Scan with strict accumulator
postscanl' :: (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Haskell-style scan
scanl :: (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Haskell-style scan with strict accumulator
scanl' :: (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Scan over a non-empty vector
scanl1 :: KnownNat n => (a -> a -> a) -> Vector (n + 1) a -> Vector (n + 1) a

-- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator
scanl1' :: KnownNat n => (a -> a -> a) -> Vector (n + 1) a -> Vector (n + 1) a

-- | <i>O(n)</i> Right-to-left prescan
prescanr :: (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left prescan with strict accumulator
prescanr' :: (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left scan
postscanr :: (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left scan with strict accumulator
postscanr' :: (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left Haskell-style scan
scanr :: (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator
scanr' :: (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left scan over a non-empty vector
scanr1 :: KnownNat n => (a -> a -> a) -> Vector (n + 1) a -> Vector (n + 1) a

-- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict
--   accumulator
scanr1' :: KnownNat n => (a -> a -> a) -> Vector (n + 1) a -> Vector (n + 1) a

-- | <i>O(n)</i> Convert a vector to a list
toList :: Vector n a -> [a]

-- | <i>O(n)</i> Convert a list to a vector
fromList :: KnownNat n => [a] -> Maybe (Vector n a)

-- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a
--   vector. The length of the resultant vector is inferred from the type.
fromListN :: forall n a. KnownNat n => [a] -> Maybe (Vector n a)

-- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a
--   vector. The length of the resultant vector is given explicitly as a
--   <a>Proxy</a> argument.
fromListN' :: forall n a. KnownNat n => Proxy n -> [a] -> Maybe (Vector n a)

-- | <i>O(n)</i> 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 <a>withSized</a>
withSizedList :: forall a r. [a] -> (forall n. KnownNat n => Vector n a -> r) -> r

-- | Convert a <a>Vector</a> into a <a>Vector</a> if it has the correct
--   size, otherwise return Nothing.
toSized :: forall n a. KnownNat n => Vector a -> Maybe (Vector n a)

-- | Takes a <a>Vector</a> and returns a continuation providing a
--   <a>Vector</a> with a size parameter <tt>n</tt> that is determined at
--   runtime based on the length of the input vector.
--   
--   Essentially converts a <a>Vector</a> into a <a>Vector</a> with the
--   correct size parameter <tt>n</tt>.
withSized :: forall a r. Vector a -> (forall n. KnownNat n => Vector n a -> r) -> r
fromSized :: Vector n a -> Vector a

-- | Apply a function on unsized vectors to a sized vector. The function
--   must preserve the size of the vector, this is not checked.
withVectorUnsafe :: (Vector a -> Vector b) -> Vector n a -> Vector n b


-- | This module re-exports the functionality in <a>Sized</a> specialized
--   to <a>Storable</a>
--   
--   Functions returning a vector determine the size from the type context
--   unless they have a <tt>'</tt> suffix in which case they take an
--   explicit <a>Proxy</a> argument.
--   
--   Functions where the resultant vector size is not know until compile
--   time are not exported.
module Data.Vector.Storable.Sized

-- | <a>Vector</a> specialized to use <a>Storable</a>
type Vector = Vector Vector

-- | <i>O(1)</i> Yield the length of the vector as an <a>Int</a>.
length :: forall n a. (KnownNat n) => Vector n a -> Int

-- | <i>O(1)</i> Yield the length of the vector as a <a>Proxy</a>.
length' :: forall n a. (KnownNat n) => Vector n a -> Proxy n

-- | <i>O(1)</i> Safe indexing using a <a>Finite</a>.
index :: forall n a. (KnownNat n, Storable a) => Vector n a -> Finite n -> a

-- | <i>O(1)</i> Safe indexing using a <a>Proxy</a>.
index' :: forall n m a. (KnownNat n, KnownNat m, Storable a) => Vector ((n + m) + 1) a -> Proxy n -> a

-- | <i>O(1)</i> Indexing using an Int without bounds checking.
unsafeIndex :: forall n a. (KnownNat n, Storable a) => Vector n a -> Int -> a

-- | <i>O(1)</i> Yield the first element of a non-empty vector.
head :: forall n a. (Storable a) => Vector (n + 1) a -> a

-- | <i>O(1)</i> Yield the last element of a non-empty vector.
last :: forall n a. (Storable a) => Vector (n + 1) a -> a

-- | <i>O(1)</i> Safe indexing in a monad. See the documentation for
--   <a>indexM</a> for an explanation of why this is useful.
indexM :: forall n a m. (KnownNat n, Storable a, Monad m) => Vector n a -> Finite n -> m a

-- | <i>O(1)</i> Safe indexing in a monad using a <a>Proxy</a>. See the
--   documentation for <a>indexM</a> for an explanation of why this is
--   useful.
indexM' :: forall n k a m. (KnownNat n, KnownNat k, Storable a, Monad m) => Vector (n + k) a -> Proxy n -> m a

-- | <i>O(1)</i> Indexing using an Int without bounds checking. See the
--   documentation for <a>indexM</a> for an explanation of why this is
--   useful.
unsafeIndexM :: forall n a m. (KnownNat n, Storable a, Monad m) => Vector n a -> Int -> m a

-- | <i>O(1)</i> Yield the first element of a non-empty vector in a monad.
--   See the documentation for <a>indexM</a> for an explanation of why this
--   is useful.
headM :: forall n a m. (KnownNat n, Storable a, Monad m) => Vector (n + 1) a -> m a

-- | <i>O(1)</i> Yield the last element of a non-empty vector in a monad.
--   See the documentation for <a>indexM</a> for an explanation of why this
--   is useful.
lastM :: forall n a m. (KnownNat n, Storable a, Monad m) => Vector (n + 1) a -> m a

-- | <i>O(1)</i> Yield a slice of the vector without copying it with an
--   inferred length argument.
slice :: forall i n a. (KnownNat i, KnownNat n, Storable a) => Proxy i -> Vector (i + n) a -> Vector n a

-- | <i>O(1)</i> Yield a slice of the vector without copying it with an
--   explicit length argument.
slice' :: forall i n a. (KnownNat i, KnownNat n, Storable a) => Proxy i -> Proxy n -> Vector (i + n) a -> Vector n a

-- | <i>O(1)</i> Yield all but the last element of a non-empty vector
--   without copying.
init :: forall n a. (Storable a) => Vector (n + 1) a -> Vector n a

-- | <i>O(1)</i> Yield all but the first element of a non-empty vector
--   without copying.
tail :: forall n a. (Storable a) => Vector (n + 1) a -> Vector n a

-- | <i>O(1)</i> Yield the first n elements. The resultant vector always
--   contains this many elements. The length of the resultant vector is
--   inferred from the type.
take :: forall n m a. (KnownNat n, KnownNat m, Storable a) => Vector (m + n) a -> Vector n a

-- | <i>O(1)</i> Yield the first n elements. The resultant vector always
--   contains this many elements. The length of the resultant vector is
--   given explicitly as a <a>Proxy</a> argument.
take' :: forall n m a. (KnownNat n, KnownNat m, Storable a) => Proxy n -> Vector (m + n) a -> Vector n a

-- | <i>O(1)</i> Yield all but the the first n elements. The given vector
--   must contain at least this many elements The length of the resultant
--   vector is inferred from the type.
drop :: forall n m a. (KnownNat n, KnownNat m, Storable a) => Vector (m + n) a -> Vector m a

-- | <i>O(1)</i> Yield all but the the first n elements. The given vector
--   must contain at least this many elements The length of the resultant
--   vector is givel explicitly as a <a>Proxy</a> argument.
drop' :: forall n m a. (KnownNat n, KnownNat m, Storable a) => Proxy n -> Vector (m + n) a -> Vector m a

-- | <i>O(1)</i> Yield the first n elements paired with the remainder
--   without copying. The lengths of the resultant vector are inferred from
--   the type.
splitAt :: forall n m a. (KnownNat n, KnownNat m, Storable a) => Vector (n + m) a -> (Vector n a, Vector m a)

-- | <i>O(1)</i> Yield the first n elements paired with the remainder
--   without copying. The length of the first resultant vector is passed
--   explicitly as a <a>Proxy</a> argument.
splitAt' :: forall n m a. (KnownNat n, KnownNat m, Storable a) => Proxy n -> Vector (n + m) a -> (Vector n a, Vector m a)

-- | <i>O(1)</i> Empty vector.
empty :: forall a. (Storable a) => Vector 0 a

-- | <i>O(1)</i> Vector with exactly one element.
singleton :: forall a. (Storable a) => a -> Vector 1 a

-- | <i>O(n)</i> Construct a vector with the same element in each position
--   where the length is inferred from the type.
replicate :: forall n a. (KnownNat n, Storable a) => a -> Vector n a

-- | <i>O(n)</i> Construct a vector with the same element in each position
--   where the length is given explicitly as a <a>Proxy</a> argument.
replicate' :: forall n a. (KnownNat n, Storable a) => Proxy n -> a -> Vector n a

-- | <i>O(n)</i> construct a vector of the given length by applying the
--   function to each index where the length is inferred from the type.
generate :: forall n a. (KnownNat n, Storable a) => (Int -> a) -> Vector n a

-- | <i>O(n)</i> construct a vector of the given length by applying the
--   function to each index where the length is given explicitly as a
--   <a>Proxy</a> argument.
generate' :: forall n a. (KnownNat n, Storable a) => Proxy n -> (Int -> a) -> Vector n a

-- | <i>O(n)</i> construct a vector of the given length by applying the
--   function to each index where the length is inferred from the type.
--   
--   The function can expect a <tt><a>Finite</a> n</tt>, meaning that its
--   input will always be between <tt>0</tt> and <tt>n - 1</tt>.
generate_ :: forall n a. (KnownNat n, Storable a) => (Finite n -> a) -> Vector n a

-- | <i>O(n)</i> Apply function n times to value. Zeroth element is
--   original value. The length is inferred from the type.
iterateN :: forall n a. (KnownNat n, Storable a) => (a -> a) -> a -> Vector n a

-- | <i>O(n)</i> Apply function n times to value. Zeroth element is
--   original value. The length is given explicitly as a <a>Proxy</a>
--   argument.
iterateN' :: forall n a. (KnownNat n, Storable a) => Proxy n -> (a -> a) -> a -> Vector n a

-- | <i>O(n)</i> Execute the monadic action <tt>n</tt> times and store the
--   results in a vector where <tt>n</tt> is inferred from the type.
replicateM :: forall n m a. (KnownNat n, Storable a, Monad m) => m a -> m (Vector n a)

-- | <i>O(n)</i> Execute the monadic action <tt>n</tt> times and store the
--   results in a vector where <tt>n</tt> is given explicitly as a
--   <a>Proxy</a> argument.
replicateM' :: forall n m a. (KnownNat n, Storable a, Monad m) => Proxy n -> m a -> m (Vector n a)

-- | <i>O(n)</i> Construct a vector of length <tt>n</tt> by applying the
--   monadic action to each index where n is inferred from the type.
generateM :: forall n m a. (KnownNat n, Storable a, Monad m) => (Int -> m a) -> m (Vector n a)

-- | <i>O(n)</i> Construct a vector of length <tt>n</tt> by applying the
--   monadic action to each index where n is given explicitly as a
--   <a>Proxy</a> argument.
generateM' :: forall n m a. (KnownNat n, Storable a, Monad m) => Proxy n -> (Int -> m a) -> m (Vector n a)

-- | <i>O(n)</i> Construct a vector of length <tt>n</tt> by applying the
--   monadic action to each index where n is inferred from the type.
--   
--   The function can expect a <tt><a>Finite</a> n</tt>, meaning that its
--   input will always be between <tt>0</tt> and <tt>n - 1</tt>.
generateM_ :: forall n m a. (KnownNat n, Storable a, Monad m) => (Finite n -> m a) -> m (Vector n a)

-- | <i>O(n)</i> Construct a vector with exactly <tt>n</tt> elements by
--   repeatedly applying the generator function to the a seed. The length,
--   <tt>n</tt>, is inferred from the type.
unfoldrN :: forall n a b. (KnownNat n, Storable a) => (b -> (a, b)) -> b -> Vector n a

-- | <i>O(n)</i> Construct a vector with exactly <tt>n</tt> elements by
--   repeatedly applying the generator function to the a seed. The length,
--   <tt>n</tt>, is given explicitly as a <a>Proxy</a> argument.
unfoldrN' :: forall n a b. (KnownNat n, Storable a) => Proxy n -> (b -> (a, b)) -> b -> Vector n a

-- | <i>O(n)</i> Yield a vector of length <tt>n</tt> containing the values
--   <tt>x</tt>, <tt>x+1</tt> etc. The length, <tt>n</tt>, is inferred from
--   the type.
enumFromN :: forall n a. (KnownNat n, Storable a, Num a) => a -> Vector n a

-- | <i>O(n)</i> Yield a vector of length <tt>n</tt> containing the values
--   <tt>x</tt>, <tt>x+1</tt> etc. The length, <tt>n</tt>, is given
--   explicitly as a <a>Proxy</a> argument.
enumFromN' :: forall n a. (KnownNat n, Storable a, Num a) => a -> Proxy n -> Vector n a

-- | <i>O(n)</i> Yield a vector of the given length containing the values
--   <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. The length, <tt>n</tt>,
--   is inferred from the type.
enumFromStepN :: forall n a. (KnownNat n, Storable a, Num a) => a -> a -> Vector n a

-- | <i>O(n)</i> Yield a vector of the given length containing the values
--   <tt>x</tt>, <tt>x+y</tt>, <tt>x+y+y</tt> etc. The length, <tt>n</tt>,
--   is given explicitly as a <a>Proxy</a> argument.
enumFromStepN' :: forall n a. (KnownNat n, Storable a, Num a) => a -> a -> Proxy n -> Vector n a

-- | <i>O(n)</i> Prepend an element.
cons :: forall n a. Storable a => a -> Vector n a -> Vector (n + 1) a

-- | <i>O(n)</i> Append an element.
snoc :: forall n a. Storable a => Vector n a -> a -> Vector (n + 1) a

-- | <i>O(m+n)</i> Concatenate two vectors.
(++) :: forall n m a. Storable a => Vector n a -> Vector m a -> Vector (n + m) a

-- | <i>O(n)</i> 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:
--   
--   <pre>
--   force (slice 0 2 &lt;huge vector&gt;)
--   </pre>
--   
--   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.
force :: Storable a => Vector n a -> Vector n a

-- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the list, replace the
--   vector element at position <tt>i</tt> by <tt>a</tt>.
--   
--   <pre>
--   &lt;5,9,2,7&gt; // [(2,1),(0,3),(2,8)] = &lt;3,9,8,7&gt;
--   </pre>
(//) :: (Storable a) => Vector m a -> [(Int, a)] -> Vector m a

-- | <i>O(m+n)</i> For each pair <tt>(i,a)</tt> from the vector of
--   index/value pairs, replace the vector element at position <tt>i</tt>
--   by <tt>a</tt>.
--   
--   <pre>
--   update &lt;5,9,2,7&gt; &lt;(2,1),(0,3),(2,8)&gt; = &lt;3,9,8,7&gt;
--   </pre>
update :: (Storable a, Storable (Int, a)) => Vector m a -> Vector n (Int, a) -> Vector m a

-- | <i>O(m+n)</i> For each index <tt>i</tt> from the index vector and the
--   corresponding value <tt>a</tt> from the value vector, replace the
--   element of the initial vector at position <tt>i</tt> by <tt>a</tt>.
--   
--   <pre>
--   update_ &lt;5,9,2,7&gt;  &lt;2,0,2&gt; &lt;1,3,8&gt; = &lt;3,9,8,7&gt;
--   </pre>
--   
--   This function is useful for instances of <a>Vector</a> that cannot
--   store pairs. Otherwise, <a>update</a> is probably more convenient.
--   
--   <pre>
--   update_ xs is ys = <a>update</a> xs (<a>zip</a> is ys)
--   </pre>
update_ :: Storable a => Vector m a -> Vector n Int -> Vector n a -> Vector m a

-- | Same as (<a>//</a>) but without bounds checking.
unsafeUpd :: (Storable a) => Vector m a -> [(Int, a)] -> Vector m a

-- | Same as <a>update</a> but without bounds checking.
unsafeUpdate :: (Storable a, Storable (Int, a)) => Vector m a -> Vector n (Int, a) -> Vector m a

-- | Same as <a>update_</a> but without bounds checking.
unsafeUpdate_ :: Storable a => Vector m a -> Vector n Int -> Vector n a -> Vector m a

-- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the list, replace the
--   vector element <tt>a</tt> at position <tt>i</tt> by <tt>f a b</tt>.
--   
--   <pre>
--   accum (+) &lt;5,9,2&gt; [(2,4),(1,6),(0,3),(1,7)] = &lt;5+3, 9+6+7, 2+4&gt;
--   </pre>
accum :: Storable a => (a -> b -> a) -> Vector m a -> [(Int, b)] -> Vector m a

-- | <i>O(m+n)</i> For each pair <tt>(i,b)</tt> from the vector of pairs,
--   replace the vector element <tt>a</tt> at position <tt>i</tt> by <tt>f
--   a b</tt>.
--   
--   <pre>
--   accumulate (+) &lt;5,9,2&gt; &lt;(2,4),(1,6),(0,3),(1,7)&gt; = &lt;5+3, 9+6+7, 2+4&gt;
--   </pre>
accumulate :: (Storable a, Storable (Int, b)) => (a -> b -> a) -> Vector m a -> Vector n (Int, b) -> Vector m a

-- | <i>O(m+n)</i> For each index <tt>i</tt> from the index vector and the
--   corresponding value <tt>b</tt> from the the value vector, replace the
--   element of the initial vector at position <tt>i</tt> by <tt>f a
--   b</tt>.
--   
--   <pre>
--   accumulate_ (+) &lt;5,9,2&gt; &lt;2,1,0,1&gt; &lt;4,6,3,7&gt; = &lt;5+3, 9+6+7, 2+4&gt;
--   </pre>
--   
--   This function is useful for instances of <a>Vector</a> that cannot
--   store pairs. Otherwise, <a>accumulate</a> is probably more convenient:
--   
--   <pre>
--   accumulate_ f as is bs = <a>accumulate</a> f as (<a>zip</a> is bs)
--   </pre>
accumulate_ :: (Storable a, Storable b) => (a -> b -> a) -> Vector m a -> Vector n Int -> Vector n b -> Vector m a

-- | Same as <a>accum</a> but without bounds checking.
unsafeAccum :: Storable a => (a -> b -> a) -> Vector m a -> [(Int, b)] -> Vector m a

-- | Same as <a>accumulate</a> but without bounds checking.
unsafeAccumulate :: (Storable a, Storable (Int, b)) => (a -> b -> a) -> Vector m a -> Vector n (Int, b) -> Vector m a

-- | Same as <a>accumulate_</a> but without bounds checking.
unsafeAccumulate_ :: (Storable a, Storable b) => (a -> b -> a) -> Vector m a -> Vector n Int -> Vector n b -> Vector m a

-- | <i>O(n)</i> Reverse a vector
reverse :: (Storable a) => Vector n a -> Vector n a

-- | <i>O(n)</i> Yield the vector obtained by replacing each element
--   <tt>i</tt> of the index vector by <tt>xs<tt>!</tt>i</tt>. This is
--   equivalent to <tt><a>map</a> (xs<tt>!</tt>) is</tt> but is often much
--   more efficient.
--   
--   <pre>
--   backpermute &lt;a,b,c,d&gt; &lt;0,3,2,3,1,0&gt; = &lt;a,d,c,d,b,a&gt;
--   </pre>
backpermute :: Storable a => Vector m a -> Vector n Int -> Vector n a

-- | Same as <a>backpermute</a> but without bounds checking.
unsafeBackpermute :: Storable a => Vector m a -> Vector n Int -> Vector n a

-- | <i>O(n)</i> Pair each element in a vector with its index
indexed :: (Storable a, Storable (Int, a)) => Vector n a -> Vector n (Int, a)

-- | <i>O(n)</i> Map a function over a vector
map :: (Storable a, Storable b) => (a -> b) -> Vector n a -> Vector n b

-- | <i>O(n)</i> Apply a function to every element of a vector and its
--   index
imap :: (Storable a, Storable b) => (Int -> a -> b) -> Vector n a -> Vector n b

-- | <i>O(n*m)</i> Map a function over a vector and concatenate the
--   results. The function is required to always return the same length
--   vector.
concatMap :: (Storable a, Storable b) => (a -> Vector m b) -> Vector n a -> Vector (n * m) b

-- | <i>O(n)</i> Apply the monadic action to all elements of the vector,
--   yielding a vector of results
mapM :: (Monad m, Storable a, Storable b) => (a -> m b) -> Vector n a -> m (Vector n b)

-- | <i>O(n)</i> Apply the monadic action to every element of a vector and
--   its index, yielding a vector of results
imapM :: (Monad m, Storable a, Storable b) => (Int -> a -> m b) -> Vector n a -> m (Vector n b)

-- | <i>O(n)</i> Apply the monadic action to all elements of a vector and
--   ignore the results
mapM_ :: (Monad m, Storable a) => (a -> m b) -> Vector n a -> m ()

-- | <i>O(n)</i> Apply the monadic action to every element of a vector and
--   its index, ignoring the results
imapM_ :: (Monad m, Storable a) => (Int -> a -> m b) -> Vector n a -> m ()

-- | <i>O(n)</i> Apply the monadic action to all elements of the vector,
--   yielding a vector of results. Equvalent to <tt>flip <a>mapM</a></tt>.
forM :: (Monad m, Storable a, Storable b) => Vector n a -> (a -> m b) -> m (Vector n b)

-- | <i>O(n)</i> Apply the monadic action to all elements of a vector and
--   ignore the results. Equivalent to <tt>flip <a>mapM_</a></tt>.
forM_ :: (Monad m, Storable a) => Vector n a -> (a -> m b) -> m ()

-- | <i>O(n)</i> Zip two vectors of the same length with the given
--   function.
zipWith :: (Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector n a -> Vector n b -> Vector n c

-- | Zip three vectors with the given function.
zipWith3 :: (Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector n a -> Vector n b -> Vector n c -> Vector n d
zipWith4 :: (Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e
zipWith5 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f) => (a -> b -> c -> d -> e -> f) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f
zipWith6 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f, Storable g) => (a -> b -> c -> d -> e -> f -> g) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f -> Vector n g

-- | <i>O(n)</i> Zip two vectors of the same length with a function that
--   also takes the elements' indices).
izipWith :: (Storable a, Storable b, Storable c) => (Int -> a -> b -> c) -> Vector n a -> Vector n b -> Vector n c
izipWith3 :: (Storable a, Storable b, Storable c, Storable d) => (Int -> a -> b -> c -> d) -> Vector n a -> Vector n b -> Vector n c -> Vector n d
izipWith4 :: (Storable a, Storable b, Storable c, Storable d, Storable e) => (Int -> a -> b -> c -> d -> e) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e
izipWith5 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f
izipWith6 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f, Storable g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f -> Vector n g

-- | <i>O(n)</i> Zip two vectors of the same length
zip :: (Storable a, Storable b, Storable (a, b)) => Vector n a -> Vector n b -> Vector n (a, b)
zip3 :: (Storable a, Storable b, Storable c, Storable (a, b, c)) => Vector n a -> Vector n b -> Vector n c -> Vector n (a, b, c)
zip4 :: (Storable a, Storable b, Storable c, Storable d, Storable (a, b, c, d)) => Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n (a, b, c, d)
zip5 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable (a, b, c, d, e)) => Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n (a, b, c, d, e)
zip6 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f, Storable (a, b, c, d, e, f)) => Vector n a -> Vector n b -> Vector n c -> Vector n d -> Vector n e -> Vector n f -> Vector n (a, b, c, d, e, f)

-- | <i>O(n)</i> Zip the two vectors of the same length with the monadic
--   action and yield a vector of results
zipWithM :: (Monad m, Storable a, Storable b, Storable c) => (a -> b -> m c) -> Vector n a -> Vector n b -> m (Vector n c)

-- | <i>O(n)</i> Zip the two vectors with a monadic action that also takes
--   the element index and yield a vector of results
izipWithM :: (Monad m, Storable a, Storable b, Storable c) => (Int -> a -> b -> m c) -> Vector n a -> Vector n b -> m (Vector n c)

-- | <i>O(n)</i> Zip the two vectors with the monadic action and ignore the
--   results
zipWithM_ :: (Monad m, Storable a, Storable b) => (a -> b -> m c) -> Vector n a -> Vector n b -> m ()

-- | <i>O(n)</i> Zip the two vectors with a monadic action that also takes
--   the element index and ignore the results
izipWithM_ :: (Monad m, Storable a, Storable b) => (Int -> a -> b -> m c) -> Vector n a -> Vector n b -> m ()

-- | <i>O(min(m,n))</i> Unzip a vector of pairs.
unzip :: (Storable a, Storable b, Storable (a, b)) => Vector n (a, b) -> (Vector n a, Vector n b)
unzip3 :: (Storable a, Storable b, Storable c, Storable (a, b, c)) => Vector n (a, b, c) -> (Vector n a, Vector n b, Vector n c)
unzip4 :: (Storable a, Storable b, Storable c, Storable d, Storable (a, b, c, d)) => Vector n (a, b, c, d) -> (Vector n a, Vector n b, Vector n c, Vector n d)
unzip5 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable (a, b, c, d, e)) => Vector n (a, b, c, d, e) -> (Vector n a, Vector n b, Vector n c, Vector n d, Vector n e)
unzip6 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f, Storable (a, b, c, d, e, f)) => Vector n (a, b, c, d, e, f) -> (Vector n a, Vector n b, Vector n c, Vector n d, Vector n e, Vector n f)

-- | <i>O(n)</i> Check if the vector contains an element
elem :: (Storable a, Eq a) => a -> Vector n a -> Bool
infix 4 `elem`

-- | <i>O(n)</i> Check if the vector does not contain an element (inverse
--   of <a>elem</a>)
notElem :: (Storable a, Eq a) => a -> Vector n a -> Bool
infix 4 `notElem`

-- | <i>O(n)</i> Yield <a>Just</a> the first element matching the predicate
--   or <a>Nothing</a> if no such element exists.
find :: Storable a => (a -> Bool) -> Vector n a -> Maybe a

-- | <i>O(n)</i> Yield <a>Just</a> the index of the first element matching
--   the predicate or <a>Nothing</a> if no such element exists.
findIndex :: Storable a => (a -> Bool) -> Vector n a -> Maybe Int

-- | <i>O(n)</i> Yield <a>Just</a> the index of the first occurence of the
--   given element or <a>Nothing</a> if the vector does not contain the
--   element. This is a specialised version of <a>findIndex</a>.
elemIndex :: (Storable a, Eq a) => a -> Vector n a -> Maybe Int

-- | <i>O(n)</i> Left fold
foldl :: Storable b => (a -> b -> a) -> a -> Vector n b -> a

-- | <i>O(n)</i> Left fold on non-empty vectors
foldl1 :: (Storable a, KnownNat n) => (a -> a -> a) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Left fold with strict accumulator
foldl' :: Storable b => (a -> b -> a) -> a -> Vector n b -> a

-- | <i>O(n)</i> Left fold on non-empty vectors with strict accumulator
foldl1' :: (Storable a, KnownNat n) => (a -> a -> a) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Right fold
foldr :: Storable a => (a -> b -> b) -> b -> Vector n a -> b

-- | <i>O(n)</i> Right fold on non-empty vectors
foldr1 :: (Storable a, KnownNat n) => (a -> a -> a) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Right fold with a strict accumulator
foldr' :: Storable a => (a -> b -> b) -> b -> Vector n a -> b

-- | <i>O(n)</i> Right fold on non-empty vectors with strict accumulator
foldr1' :: (Storable a, KnownNat n) => (a -> a -> a) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Left fold (function applied to each element and its index)
ifoldl :: Storable b => (a -> Int -> b -> a) -> a -> Vector n b -> a

-- | <i>O(n)</i> Left fold with strict accumulator (function applied to
--   each element and its index)
ifoldl' :: Storable b => (a -> Int -> b -> a) -> a -> Vector n b -> a

-- | <i>O(n)</i> Right fold (function applied to each element and its
--   index)
ifoldr :: Storable a => (Int -> a -> b -> b) -> b -> Vector n a -> b

-- | <i>O(n)</i> Right fold with strict accumulator (function applied to
--   each element and its index)
ifoldr' :: Storable a => (Int -> a -> b -> b) -> b -> Vector n a -> b

-- | <i>O(n)</i> Check if all elements satisfy the predicate.
all :: Storable a => (a -> Bool) -> Vector n a -> Bool

-- | <i>O(n)</i> Check if any element satisfies the predicate.
any :: Storable a => (a -> Bool) -> Vector n a -> Bool

-- | <i>O(n)</i> Check if all elements are <a>True</a>
and :: Vector n Bool -> Bool

-- | <i>O(n)</i> Check if any element is <a>True</a>
or :: Vector n Bool -> Bool

-- | <i>O(n)</i> Compute the sum of the elements
sum :: (Storable a, Num a) => Vector n a -> a

-- | <i>O(n)</i> Compute the produce of the elements
product :: (Storable a, Num a) => Vector n a -> a

-- | <i>O(n)</i> Yield the maximum element of the non-empty vector.
maximum :: (Storable a, Ord a, KnownNat n) => Vector (n + 1) a -> a

-- | <i>O(n)</i> Yield the maximum element of the non-empty vector
--   according to the given comparison function.
maximumBy :: (Storable a, KnownNat n) => (a -> a -> Ordering) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Yield the minimum element of the non-empty vector.
minimum :: (Storable a, Ord a, KnownNat n) => Vector (n + 1) a -> a

-- | <i>O(n)</i> Yield the minimum element of the non-empty vector
--   according to the given comparison function.
minimumBy :: (Storable a, KnownNat n) => (a -> a -> Ordering) -> Vector (n + 1) a -> a

-- | <i>O(n)</i> Yield the index of the maximum element of the non-empty
--   vector.
maxIndex :: (Storable a, Ord a, KnownNat n) => Vector (n + 1) a -> Int

-- | <i>O(n)</i> Yield the index of the maximum element of the non-empty
--   vector according to the given comparison function.
maxIndexBy :: (Storable a, KnownNat n) => (a -> a -> Ordering) -> Vector (n + 1) a -> Int

-- | <i>O(n)</i> Yield the index of the minimum element of the non-empty
--   vector.
minIndex :: (Storable a, Ord a, KnownNat n) => Vector (n + 1) a -> Int

-- | <i>O(n)</i> Yield the index of the minimum element of the non-empty
--   vector according to the given comparison function.
minIndexBy :: (Storable a, KnownNat n) => (a -> a -> Ordering) -> Vector (n + 1) a -> Int

-- | <i>O(n)</i> Monadic fold
foldM :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector n b -> m a

-- | <i>O(n)</i> Monadic fold (action applied to each element and its
--   index)
ifoldM :: (Monad m, Storable b) => (a -> Int -> b -> m a) -> a -> Vector n b -> m a

-- | <i>O(n)</i> Monadic fold over non-empty vectors
fold1M :: (Monad m, Storable a, KnownNat n) => (a -> a -> m a) -> Vector (n + 1) a -> m a

-- | <i>O(n)</i> Monadic fold with strict accumulator
foldM' :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector n b -> m a

-- | <i>O(n)</i> Monadic fold with strict accumulator (action applied to
--   each element and its index)
ifoldM' :: (Monad m, Storable b) => (a -> Int -> b -> m a) -> a -> Vector n b -> m a

-- | <i>O(n)</i> Monadic fold over non-empty vectors with strict
--   accumulator
fold1M' :: (Monad m, Storable a, KnownNat n) => (a -> a -> m a) -> Vector (n + 1) a -> m a

-- | <i>O(n)</i> Monadic fold that discards the result
foldM_ :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector n b -> m ()

-- | <i>O(n)</i> Monadic fold that discards the result (action applied to
--   each element and its index)
ifoldM_ :: (Monad m, Storable b) => (a -> Int -> b -> m a) -> a -> Vector n b -> m ()

-- | <i>O(n)</i> Monadic fold over non-empty vectors that discards the
--   result
fold1M_ :: (Monad m, Storable a, KnownNat n) => (a -> a -> m a) -> Vector (n + 1) a -> m ()

-- | <i>O(n)</i> Monadic fold with strict accumulator that discards the
--   result
foldM'_ :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector n b -> m ()

-- | <i>O(n)</i> Monadic fold with strict accumulator that discards the
--   result (action applied to each element and its index)
ifoldM'_ :: (Monad m, Storable b) => (a -> Int -> b -> m a) -> a -> Vector n b -> m ()

-- | <i>O(n)</i> Monad fold over non-empty vectors with strict accumulator
--   that discards the result
fold1M'_ :: (Monad m, Storable a, KnownNat n) => (a -> a -> m a) -> Vector (n + 1) a -> m ()

-- | Evaluate each action and collect the results
sequence :: (Monad m, Storable a, Storable (m a)) => Vector n (m a) -> m (Vector n a)

-- | Evaluate each action and discard the results
sequence_ :: (Monad m, Storable (m a)) => Vector n (m a) -> m ()

-- | <i>O(n)</i> Prescan
--   
--   <pre>
--   prescanl f z = <a>init</a> . <a>scanl</a> f z
--   </pre>
--   
--   Example: <tt>prescanl (+) 0 &lt;1,2,3,4&gt; = &lt;0,1,3,6&gt;</tt>
prescanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Prescan with strict accumulator
prescanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Scan
postscanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Scan with strict accumulator
postscanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Haskell-style scan
scanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Haskell-style scan with strict accumulator
scanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector n b -> Vector n a

-- | <i>O(n)</i> Scan over a non-empty vector
scanl1 :: (Storable a, KnownNat n) => (a -> a -> a) -> Vector (n + 1) a -> Vector (n + 1) a

-- | <i>O(n)</i> Scan over a non-empty vector with a strict accumulator
scanl1' :: (Storable a, KnownNat n) => (a -> a -> a) -> Vector (n + 1) a -> Vector (n + 1) a

-- | <i>O(n)</i> Right-to-left prescan
prescanr :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left prescan with strict accumulator
prescanr' :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left scan
postscanr :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left scan with strict accumulator
postscanr' :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left Haskell-style scan
scanr :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left Haskell-style scan with strict accumulator
scanr' :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector n a -> Vector n b

-- | <i>O(n)</i> Right-to-left scan over a non-empty vector
scanr1 :: (Storable a, KnownNat n) => (a -> a -> a) -> Vector (n + 1) a -> Vector (n + 1) a

-- | <i>O(n)</i> Right-to-left scan over a non-empty vector with a strict
--   accumulator
scanr1' :: (Storable a, KnownNat n) => (a -> a -> a) -> Vector (n + 1) a -> Vector (n + 1) a

-- | <i>O(n)</i> Convert a vector to a list
toList :: Storable a => Vector n a -> [a]

-- | <i>O(n)</i> Convert a list to a vector
fromList :: (Storable a, KnownNat n) => [a] -> Maybe (Vector n a)

-- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a
--   vector. The length of the resultant vector is inferred from the type.
fromListN :: forall n a. (Storable a, KnownNat n) => [a] -> Maybe (Vector n a)

-- | <i>O(n)</i> Convert the first <tt>n</tt> elements of a list to a
--   vector. The length of the resultant vector is given explicitly as a
--   <a>Proxy</a> argument.
fromListN' :: forall n a. (Storable a, KnownNat n) => Proxy n -> [a] -> Maybe (Vector n a)

-- | <i>O(n)</i> 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 <a>withSized</a>
withSizedList :: forall a r. Storable a => [a] -> (forall n. KnownNat n => Vector n a -> r) -> r

-- | Convert a <a>Vector</a> into a <a>Vector</a> if it has the correct
--   size, otherwise return Nothing.
toSized :: forall n a. (Storable a, KnownNat n) => Vector a -> Maybe (Vector n a)

-- | Takes a <a>Vector</a> and returns a continuation providing a
--   <a>Vector</a> with a size parameter <tt>n</tt> that is determined at
--   runtime based on the length of the input vector.
--   
--   Essentially converts a <a>Vector</a> into a <a>Vector</a> with the
--   correct size parameter <tt>n</tt>.
withSized :: forall a r. Storable a => Vector a -> (forall n. KnownNat n => Vector n a -> r) -> r
fromSized :: Vector n a -> Vector a

-- | Apply a function on unsized vectors to a sized vector. The function
--   must preserve the size of the vector, this is not checked.
withVectorUnsafe :: forall a b (n :: Nat). (Storable a, Storable b) => (Vector a -> Vector b) -> Vector n a -> Vector n b
