vector-sized-1.5.0: Size tagged vectors
Safe Haskell None
Language Haskell2010

Data.Vector.Generic.Sized.Internal

Synopsis

Documentation

newtype Vector v (n :: Nat ) a Source #

A wrapper to tag vectors with a type level length.

Be careful when using the constructor here to not construct sized vectors which have a different length than that specified in the type parameter!

Constructors

Vector (v a)

Instances

Instances details
( Unbox a, KnownNat n) => Vector Vector ( Vector Vector n a) Source #
Instance details

Defined in Data.Vector.Unboxed.Mutable.Sized

( Unbox a, KnownNat n) => MVector MVector ( Vector Vector n a) Source #
Instance details

Defined in Data.Vector.Unboxed.Mutable.Sized

KnownNat n => Monad ( Vector Vector n) Source #

Treats a Vector n a as, essentially, a Finite n -> a , and emulates the Monad instance for that function.

join :: Vector n (Vector n a) -> Vector n a gets the diagonal from a square "matrix".

Instance details

Defined in Data.Vector.Generic.Sized

Functor v => Functor ( Vector v n) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

Methods

fmap :: (a -> b) -> Vector v n a -> Vector v n b Source #

(<$) :: a -> Vector v n b -> Vector v n a Source #

KnownNat n => Applicative ( Vector Vector n) Source #

The Applicative instance for sized vectors does not have the same behaviour as the Applicative instance for the unsized vectors found in the vectors package. The instance defined here has the same behaviour as the ZipList instance.

Instance details

Defined in Data.Vector.Generic.Sized

Foldable v => Foldable ( Vector v n) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

Methods

fold :: Monoid m => Vector v n m -> m Source #

foldMap :: Monoid m => (a -> m) -> Vector v n a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Vector v n a -> m Source #

foldr :: (a -> b -> b) -> b -> Vector v n a -> b Source #

foldr' :: (a -> b -> b) -> b -> Vector v n a -> b Source #

foldl :: (b -> a -> b) -> b -> Vector v n a -> b Source #

foldl' :: (b -> a -> b) -> b -> Vector v n a -> b Source #

foldr1 :: (a -> a -> a) -> Vector v n a -> a Source #

foldl1 :: (a -> a -> a) -> Vector v n a -> a Source #

toList :: Vector v n a -> [a] Source #

null :: Vector v n a -> Bool Source #

length :: Vector v n a -> Int Source #

elem :: Eq a => a -> Vector v n a -> Bool Source #

maximum :: Ord a => Vector v n a -> a Source #

minimum :: Ord a => Vector v n a -> a Source #

sum :: Num a => Vector v n a -> a Source #

product :: Num a => Vector v n a -> a Source #

Traversable v => Traversable ( Vector v n) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

Methods

traverse :: Applicative f => (a -> f b) -> Vector v n a -> f ( Vector v n b) Source #

sequenceA :: Applicative f => Vector v n (f a) -> f ( Vector v n a) Source #

mapM :: Monad m => (a -> m b) -> Vector v n a -> m ( Vector v n b) Source #

sequence :: Monad m => Vector v n (m a) -> m ( Vector v n a) Source #

KnownNat n => Distributive ( Vector Vector n) Source #
Instance details

Defined in Data.Vector.Generic.Sized

KnownNat n => Representable ( Vector Vector n) Source #
Instance details

Defined in Data.Vector.Generic.Sized

Associated Types

type Rep ( Vector Vector n) Source #

Eq1 v => Eq1 ( Vector v n) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

Methods

liftEq :: (a -> b -> Bool ) -> Vector v n a -> Vector v n b -> Bool Source #

Ord1 v => Ord1 ( Vector v n) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

Show1 v => Show1 ( Vector v n) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

( KnownNat n, n ~ (1 + m)) => Comonad ( Vector Vector n) Source #

Non-empty sized vectors are lawful comonads.

extract is head

duplicate generates all unique sequences of a vector with the same length as it, using wrap-around.

e.g. duplicate [1,2,3,4,5] = [[1,2,3,4,5], [2,3,4,5,1], [3,4,5,1,2], [4,5,1,2,3], [5,1,2,3,4]]

Instance details

Defined in Data.Vector.Generic.Sized

( KnownNat n, n ~ (1 + m)) => ComonadApply ( Vector Vector n) Source #
Instance details

Defined in Data.Vector.Generic.Sized

Eq (v a) => Eq ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

( Vector v a, Floating a, KnownNat n) => Floating ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized

( Vector v a, Fractional a, KnownNat n) => Fractional ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized

( KnownNat n, Typeable v, Typeable a, Data (v a)) => Data ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Vector v n a -> c ( Vector v n a) Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ( Vector v n a) Source #

toConstr :: Vector v n a -> Constr Source #

dataTypeOf :: Vector v n a -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ( Vector v n a)) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c ( Vector v n a)) Source #

gmapT :: ( forall b. Data b => b -> b) -> Vector v n a -> Vector v n a Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Vector v n a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Vector v n a -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> Vector v n a -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> Vector v n a -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Vector v n a -> m ( Vector v n a) Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Vector v n a -> m ( Vector v n a) Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Vector v n a -> m ( Vector v n a) Source #

( Vector v a, Num a, KnownNat n) => Num ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized

Ord (v a) => Ord ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

( KnownNat n, Vector v a, Read (v a)) => Read ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized

Show (v a) => Show ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

( Ix a, Ord (v a), Vector v a) => Ix ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

( Semigroup g, Vector v g) => Semigroup ( Vector v n g) Source #

The Semigroup instance for sized vectors does not have the same behaviour as the Semigroup instance for the unsized vectors found in the vectors package. This instance has (<>) = zipWith (<>) , but vectors uses concatentation.

Instance details

Defined in Data.Vector.Generic.Sized

( Monoid m, Vector v m, KnownNat n) => Monoid ( Vector v n m) Source #

The Monoid instance for sized vectors does not have the same behaviour as the Monoid instance for the unsized vectors found in the vectors package. This instance has mempty = replicate mempty and mappend = zipWith mappend , where the vectors instance uses the empty vector and concatenation.

If mempty is not necessary, using the Semigroup instance over this Monoid will dodge the KnownNat constraint.

Instance details

Defined in Data.Vector.Generic.Sized

( KnownNat n, Storable a, Vector v a) => Storable ( Vector v n a) Source #

Any sized vector containing Storable elements is itself Storable .

Instance details

Defined in Data.Vector.Generic.Sized

( Vector v a, Bits (v a), Bits a, KnownNat n) => Bits ( Vector v n a) Source #

Only usable if v a is itself an instance of Bits , like in the case with the bitvec library Bit type for unboxed vectors.

Instance details

Defined in Data.Vector.Generic.Sized

( Vector v a, Bits (v a), FiniteBits a, KnownNat n) => FiniteBits ( Vector v n a) Source #

Treats a bit vector as n times the size of the stored bits, reflecting the Bits instance; does not necessarily reflect exact in-memory representation. See Storable instance to get information on the actual in-memry representation.

Instance details

Defined in Data.Vector.Generic.Sized

( Vector v a, Binary a, KnownNat n) => Binary ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized

NFData (v a) => NFData ( Vector v n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized.Internal

Methods

rnf :: Vector v n a -> () Source #

( Eq a, Hashable a, Unbox a) => Hashable ( Vector Vector n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized

( Eq a, Hashable a, Storable a) => Hashable ( Vector Vector n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized

( Eq a, Hashable a) => Hashable ( Vector Vector n a) Source #
Instance details

Defined in Data.Vector.Generic.Sized

( Unbox a, KnownNat n) => Unbox ( Vector Vector n a) Source #

This instance allows to define sized matrices and tensors backed by continuous memory segments, which reduces memory allocations and relaxes pressure on garbage collector.

Instance details

Defined in Data.Vector.Unboxed.Mutable.Sized

newtype MVector s ( Vector Vector n a) Source #
Instance details

Defined in Data.Vector.Unboxed.Mutable.Sized

type Rep ( Vector Vector n) Source #
Instance details

Defined in Data.Vector.Generic.Sized

type Mutable ( Vector v n) Source #
Instance details

Defined in Data.Vector.Generic.Sized

newtype Vector ( Vector Vector n a) Source #
Instance details

Defined in Data.Vector.Unboxed.Mutable.Sized