-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Size tagged vectors -- -- Please see README.md @package vector-sized @version 0.1.0.0 module Data.Vector.Generic.Sized data Vector v (n :: Nat) a -- | Convert a Vector into a Vector if it has the correct -- size, otherwise return Nothing. fromVector :: (KnownNat n, Vector v a) => v a -> Maybe (Vector v n a) -- | O(n) Construct a vector with the same element in each position. replicate :: (Vector v a, KnownNat n) => a -> Vector v n a -- | O(1) construct a single element vector. singleton :: (Vector v a) => a -> Vector v 1 a -- | O(n) construct a vector of the given length by applying the -- function to each index. generate :: (Vector v a, KnownNat n) => Proxy n -> (Int -> a) -> Vector v n a -- | O(n) construct a vector of the given length by applying the -- monadic action to each index. generateM :: (Vector v a, KnownNat n, Monad m) => Proxy n -> (Int -> m a) -> m (Vector v n a) -- | O(1) Get the length of the vector. length :: (Vector v a) => Vector v n a -> Int -- | O(1) Index safely into the vector using a type level index. index :: (KnownNat n, KnownNat m, Vector v a) => Vector v (m + n) a -> Proxy n -> a -- | O(1) Get the first element of a non-empty vector. head :: (Vector v a) => Vector v (n + 1) a -> a -- | O(1) Get the last element of a non-empty vector. last :: (Vector v a) => Vector v (n + 1) a -> a -- | O(1) Yield all but the first element of a non-empty vector -- without copying. tail :: (Vector v a) => Vector v (n + 1) a -> Vector v n a -- | O(1) Yield all but the last element of a non-empty vector -- without copying. init :: (Vector v a) => Vector v (n + 1) a -> Vector v n a -- | O(1) Yield the first n elements. The resultant vector always -- contains this many elements. take :: (KnownNat n, KnownNat m, Vector v a) => Proxy n -> Vector v (m + n) a -> Vector v n a -- | O(1) Yield all but the first n elements. drop :: (KnownNat n, KnownNat m, Vector v a) => Proxy n -> Vector v (m + n) a -> Vector v m a -- | O(n) Map a function over the vector. map :: (Vector v a, Vector v b) => (a -> b) -> Vector v n a -> Vector v n b -- | O(n) Apply the monadic action to every element of a vector and -- its index, ignoring the results. imapM_ :: (Vector v a, Monad m) => (Int -> a -> m b) -> Vector v n a -> m () -- | O(n) Left fold with a strict accumulator. foldl' :: Vector v b => (a -> b -> a) -> a -> Vector v n b -> a -- | O(n) Left fold on a non-empty vector with a strict accumulator. foldl1' :: (Vector v a) => (a -> a -> a) -> Vector v (n + 1) a -> a instance Control.DeepSeq.NFData (v a) => Control.DeepSeq.NFData (Data.Vector.Generic.Sized.Vector v n a) instance Data.Foldable.Foldable v => Data.Foldable.Foldable (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) => Foreign.Storable.Storable (Data.Vector.Generic.Sized.Vector Data.Vector.Storable.Vector n a) module Data.Vector.Storable.Sized type Vector = Vector Vector -- | Convert a Vector into a Vector if it has the correct -- size, otherwise return Nothing. fromVector :: (KnownNat n, Storable a) => Vector a -> Maybe (Vector n a) -- | O(n) Construct a vector with the same element in each position. replicate :: (Storable a, KnownNat n) => a -> Vector n a -- | O(1) construct a single element vector. singleton :: Storable a => a -> Vector 1 a -- | O(n) construct a vector of the given length by applying the -- function to each index. generate :: (Storable a, KnownNat n) => Proxy n -> (Int -> a) -> Vector n a -- | O(1) Get the length of the vector. length :: (Storable a) => Vector n a -> Int -- | O(1) Index safely into the vector using a type level index. index :: (KnownNat n, KnownNat m, Storable a) => Vector (m + n) a -> Proxy n -> a -- | O(1) Get the first element of a non-empty vector. head :: (Storable a) => Vector (n + 1) a -> a -- | O(1) Get the last element of a non-empty vector. last :: (Storable a) => Vector (n + 1) a -> a -- | O(1) Yield all but the first element of a non-empty vector -- without copying. tail :: (Storable a) => Vector (n + 1) a -> Vector n a -- | O(1) Yield all but the last element of a non-empty vector -- without copying. init :: (Storable a) => Vector (n + 1) a -> Vector n a -- | O(1) Yield the first n elements. The resultant vector always -- contains this many elements. take :: (KnownNat n, KnownNat m, Storable a) => Proxy n -> Vector (m + n) a -> Vector n a -- | O(1) Yield all but the first n elements. drop :: (KnownNat n, KnownNat m, Storable a) => Proxy n -> Vector (m + n) a -> Vector m a -- | O(n) Map a function over the vector. map :: (Storable a, Storable b) => (a -> b) -> Vector n a -> Vector n b -- | O(n) Left fold with a strict accumulator. foldl' :: Storable b => (a -> b -> a) -> a -> Vector n b -> a -- | O(n) Left fold on a non-empty vector with a strict accumulator. foldl1' :: Storable a => (a -> a -> a) -> Vector (n + 1) a -> a