vector-sized-1.2.0.1: Size tagged vectors

Safe HaskellNone
LanguageHaskell2010

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
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

Methods

(>>=) :: Vector Vector0 n a -> (a -> Vector Vector0 n b) -> Vector Vector0 n b #

(>>) :: Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n b #

return :: a -> Vector Vector0 n a #

fail :: String -> Vector Vector0 n a #

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 #

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

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

Methods

pure :: a -> Vector Vector0 n a #

(<*>) :: Vector Vector0 n (a -> b) -> Vector Vector0 n a -> Vector Vector0 n b #

liftA2 :: (a -> b -> c) -> Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n c #

(*>) :: Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n b #

(<*) :: Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n a #

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

Defined in Data.Vector.Generic.Sized.Internal

Methods

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

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

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

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

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

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

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

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

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

null :: Vector v n a -> Bool #

length :: Vector v n a -> Int #

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

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

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

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

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

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) #

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

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

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

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

Defined in Data.Vector.Generic.Sized

Methods

distribute :: Functor f => f (Vector Vector0 n a) -> Vector Vector0 n (f a) #

collect :: Functor f => (a -> Vector Vector0 n b) -> f a -> Vector Vector0 n (f b) #

distributeM :: Monad m => m (Vector Vector0 n a) -> Vector Vector0 n (m a) #

collectM :: Monad m => (a -> Vector Vector0 n b) -> m a -> Vector Vector0 n (m b) #

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

Defined in Data.Vector.Generic.Sized

Associated Types

type Rep (Vector Vector n) :: Type #

Methods

tabulate :: (Rep (Vector Vector0 n) -> a) -> Vector Vector0 n a #

index :: Vector Vector0 n a -> Rep (Vector Vector0 n) -> a #

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 #

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

Defined in Data.Vector.Generic.Sized.Internal

Methods

liftCompare :: (a -> b -> Ordering) -> Vector v n a -> Vector v n b -> Ordering #

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

Defined in Data.Vector.Generic.Sized.Internal

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Vector v n a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Vector v n a] -> ShowS #

(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

Methods

extract :: Vector Vector0 n a -> a #

duplicate :: Vector Vector0 n a -> Vector Vector0 n (Vector Vector0 n a) #

extend :: (Vector Vector0 n a -> b) -> Vector Vector0 n a -> Vector Vector0 n b #

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

Defined in Data.Vector.Generic.Sized

Methods

(<@>) :: Vector Vector0 n (a -> b) -> Vector Vector0 n a -> Vector Vector0 n b #

(@>) :: Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n b #

(<@) :: Vector Vector0 n a -> Vector Vector0 n b -> Vector Vector0 n a #

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

Defined in Data.Vector.Generic.Sized.Internal

Methods

(==) :: Vector v n a -> Vector v n a -> Bool #

(/=) :: Vector v n a -> Vector v n a -> Bool #

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

Defined in Data.Vector.Generic.Sized

Methods

pi :: Vector v n a #

exp :: Vector v n a -> Vector v n a #

log :: Vector v n a -> Vector v n a #

sqrt :: Vector v n a -> Vector v n a #

(**) :: Vector v n a -> Vector v n a -> Vector v n a #

logBase :: Vector v n a -> Vector v n a -> Vector v n a #

sin :: Vector v n a -> Vector v n a #

cos :: Vector v n a -> Vector v n a #

tan :: Vector v n a -> Vector v n a #

asin :: Vector v n a -> Vector v n a #

acos :: Vector v n a -> Vector v n a #

atan :: Vector v n a -> Vector v n a #

sinh :: Vector v n a -> Vector v n a #

cosh :: Vector v n a -> Vector v n a #

tanh :: Vector v n a -> Vector v n a #

asinh :: Vector v n a -> Vector v n a #

acosh :: Vector v n a -> Vector v n a #

atanh :: Vector v n a -> Vector v n a #

log1p :: Vector v n a -> Vector v n a #

expm1 :: Vector v n a -> Vector v n a #

log1pexp :: Vector v n a -> Vector v n a #

log1mexp :: Vector v n a -> Vector v n a #

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

Defined in Data.Vector.Generic.Sized

Methods

(/) :: Vector v n a -> Vector v n a -> Vector v n a #

recip :: Vector v n a -> Vector v n a #

fromRational :: Rational -> Vector v n a #

(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) #

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

toConstr :: Vector v n a -> Constr #

dataTypeOf :: Vector v n a -> DataType #

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

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

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

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

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

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

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

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

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

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

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

Defined in Data.Vector.Generic.Sized

Methods

(+) :: Vector v n a -> Vector v n a -> Vector v n a #

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

(*) :: Vector v n a -> Vector v n a -> Vector v n a #

negate :: Vector v n a -> Vector v n a #

abs :: Vector v n a -> Vector v n a #

signum :: Vector v n a -> Vector v n a #

fromInteger :: Integer -> Vector v n a #

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

Defined in Data.Vector.Generic.Sized.Internal

Methods

compare :: Vector v n a -> Vector v n a -> Ordering #

(<) :: Vector v n a -> Vector v n a -> Bool #

(<=) :: Vector v n a -> Vector v n a -> Bool #

(>) :: Vector v n a -> Vector v n a -> Bool #

(>=) :: Vector v n a -> Vector v n a -> Bool #

max :: Vector v n a -> Vector v n a -> Vector v n a #

min :: Vector v n a -> Vector v n a -> Vector v n a #

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

Defined in Data.Vector.Generic.Sized

Methods

readsPrec :: Int -> ReadS (Vector v n a) #

readList :: ReadS [Vector v n a] #

readPrec :: ReadPrec (Vector v n a) #

readListPrec :: ReadPrec [Vector v n a] #

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

Defined in Data.Vector.Generic.Sized.Internal

Methods

showsPrec :: Int -> Vector v n a -> ShowS #

show :: Vector v n a -> String #

showList :: [Vector v n a] -> ShowS #

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

Defined in Data.Vector.Generic.Sized.Internal

Methods

range :: (Vector v n a, Vector v n a) -> [Vector v n a] #

index :: (Vector v n a, Vector v n a) -> Vector v n a -> Int #

unsafeIndex :: (Vector v n a, Vector v n a) -> Vector v n a -> Int

inRange :: (Vector v n a, Vector v n a) -> Vector v n a -> Bool #

rangeSize :: (Vector v n a, Vector v n a) -> Int #

unsafeRangeSize :: (Vector v n a, Vector v n a) -> Int

Generic (Vector v n a) Source # 
Instance details

Defined in Data.Vector.Generic.Sized.Internal

Associated Types

type Rep (Vector v n a) :: Type -> Type #

Methods

from :: Vector v n a -> Rep (Vector v n a) x #

to :: Rep (Vector v n a) x -> Vector v n a #

(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

Methods

(<>) :: Vector v n g -> Vector v n g -> Vector v n g #

sconcat :: NonEmpty (Vector v n g) -> Vector v n g #

stimes :: Integral b => b -> Vector v n g -> Vector v n g #

(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

Methods

mempty :: Vector v n m #

mappend :: Vector v n m -> Vector v n m -> Vector v n m #

mconcat :: [Vector v n m] -> Vector v n m #

(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

Methods

sizeOf :: Vector v n a -> Int #

alignment :: Vector v n a -> Int #

peekElemOff :: Ptr (Vector v n a) -> Int -> IO (Vector v n a) #

pokeElemOff :: Ptr (Vector v n a) -> Int -> Vector v n a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Vector v n a) #

pokeByteOff :: Ptr b -> Int -> Vector v n a -> IO () #

peek :: Ptr (Vector v n a) -> IO (Vector v n a) #

poke :: Ptr (Vector v n a) -> Vector v n a -> IO () #

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

Defined in Data.Vector.Generic.Sized.Internal

Methods

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

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

Defined in Data.Vector.Generic.Sized

Methods

hashWithSalt :: Int -> Vector Vector0 n a -> Int #

hash :: Vector Vector0 n a -> Int #

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

Defined in Data.Vector.Generic.Sized

Methods

hashWithSalt :: Int -> Vector Vector0 n a -> Int #

hash :: Vector Vector0 n a -> Int #

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

Defined in Data.Vector.Generic.Sized

Methods

hashWithSalt :: Int -> Vector Vector0 n a -> Int #

hash :: Vector Vector0 n a -> Int #

type Rep (Vector Vector n) Source # 
Instance details

Defined in Data.Vector.Generic.Sized

type Rep (Vector Vector n) = Finite n
type Mutable (Vector v n) Source # 
Instance details

Defined in Data.Vector.Generic.Sized

type Mutable (Vector v n) = MVector (Mutable v) n
type Rep (Vector v n a) Source # 
Instance details

Defined in Data.Vector.Generic.Sized.Internal

type Rep (Vector v n a) = D1 (MetaData "Vector" "Data.Vector.Generic.Sized.Internal" "vector-sized-1.2.0.1-He7pBCfzA8VGElnBo39WvT" True) (C1 (MetaCons "Vector" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (v a))))