-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Size tagged vectors -- -- Please see README.md @package vector-sized @version 0.2.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 :: forall a v (n :: Nat). (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 :: forall a v (n :: Nat). (Vector v a, KnownNat n) => a -> Vector v n a -- | O(1) construct a single element vector. singleton :: forall a v. (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 :: forall (n :: Nat) a v. (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 :: forall (n :: Nat) a v m. (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 :: forall a v (n :: Nat). (Vector v a) => Vector v n a -> Int -- | O(1) Index safely into the vector using a type level index. index :: forall (m :: Nat) a v (n :: Nat). (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 :: forall a v (n :: Nat). (Vector v a) => Vector v (n + 1) a -> a -- | O(1) Get the last element of a non-empty vector. last :: forall a v (n :: Nat). (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 :: forall a v (n :: Nat). (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 :: forall a v (n :: Nat). (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 :: forall (m :: Nat) a v (n :: Nat). (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 :: forall (m :: Nat) a v (n :: Nat). (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 :: forall a b v (n :: Nat). (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_ :: forall a v n b m. (Vector v a, Monad m) => (Int -> a -> m b) -> Vector v n a -> m () -- | O(n) Left fold with a strict accumulator. foldl' :: forall a b v (n :: Nat). 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' :: forall a v (n :: Nat). (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 :: forall a (n :: Nat). (KnownNat n, Storable a) => Vector a -> Maybe (Vector n a) -- | O(n) Construct a vector with the same element in each position. replicate :: forall a (n :: Nat). (Storable a, KnownNat n) => a -> Vector n a -- | O(1) construct a single element vector. singleton :: forall a. Storable a => a -> Vector 1 a -- | O(n) construct a vector of the given length by applying the -- function to each index. generate :: forall (n :: Nat) a. (Storable a, KnownNat n) => Proxy n -> (Int -> a) -> Vector n a -- | O(1) Get the length of the vector. length :: forall a (n :: Nat). (Storable a) => Vector n a -> Int -- | O(1) Index safely into the vector using a type level index. index :: forall (m :: Nat) a (n :: Nat). (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 :: forall a (n :: Nat). (Storable a) => Vector (n + 1) a -> a -- | O(1) Get the last element of a non-empty vector. last :: forall a (n :: Nat). (Storable a) => Vector (n + 1) a -> a -- | O(1) Yield all but the first element of a non-empty vector -- without copying. tail :: forall a (n :: Nat). (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 :: forall a (n :: Nat). (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 :: forall (m :: Nat) a (n :: Nat). (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 :: forall (m :: Nat) a (n :: Nat). (KnownNat n, KnownNat m, Storable a) => Proxy n -> Vector (m + n) a -> Vector m a -- | O(n) Map a function over the vector. map :: forall a b (n :: Nat). (Storable a, Storable b) => (a -> b) -> Vector n a -> Vector n b -- | O(n) Left fold with a strict accumulator. foldl' :: forall a b (n :: Nat). Storable b => (a -> b -> a) -> a -> Vector n b -> a -- | O(n) Left fold on a non-empty vector with a strict accumulator. foldl1' :: forall a (n :: Nat). Storable a => (a -> a -> a) -> Vector (n + 1) a -> a