tup-functor-0.2.0.3: Homogeneous tuplesSource codeContentsIndex
Data.Tup.Vec
Contents
The Vec type class
Type abbreviations for short vectors
The constructor types
Misc
Concatenation
Zipping
Short constructor functions
"veccing"
Description

Homogeneous lists with the length encoded in the type.

This can be considered as a different implementation of Data.Tup.Tup (one which also scales for vectors/tuples longer than 9 elements)

Synopsis
class (Functor v, Applicative v, Foldable v, Traversable v) => Vec v where
vecSize :: v a -> Int
vecToList :: v a -> [a]
vecFromList :: [a] -> v a
vecUndef :: v a -> a
undefinedVec :: v a
type Vec0 = Empty
type Vec1 = Cons Vec0
type Vec2 = Cons Vec1
type Vec3 = Cons Vec2
type Vec4 = Cons Vec3
type Vec5 = Cons Vec4
type Vec6 = Cons Vec5
type Vec7 = Cons Vec6
type Vec8 = Cons Vec7
type Vec9 = Cons Vec8
data Empty a = Empty
data Cons v a = Cons a (v a)
consUndefTail :: Vec v => Cons v a -> v a
maybeVecFromList :: Vec f => [a] -> Maybe (f a)
transposeVec :: (Vec f, Vec g) => f (g a) -> g (f a)
maybeVecConcat :: (Vec f, Vec g, Vec h) => f a -> g a -> Maybe (h a)
unsafeVecConcat :: (Vec f, Vec g, Vec h) => f a -> g a -> h a
class (Vec u, Vec v, Vec w) => VecConcat u v w | u v -> w where
vecConcat :: u a -> v a -> w a
zipVecWith :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
zipVecWith3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
zipVecWith4 :: Applicative f => (a -> b -> c -> d -> e) -> f a -> f b -> f c -> f d -> f e
zipVec :: Applicative f => f a -> f b -> f (a, b)
zipVec3 :: Applicative f => f a -> f b -> f c -> f (a, b, c)
zipVec4 :: Applicative f => f a -> f b -> f c -> f d -> f (a, b, c, d)
vec0 :: Vec0 a
vec1 :: a -> Vec1 a
vec2 :: a -> a -> Vec2 a
vec3 :: a -> a -> a -> Vec3 a
vec4 :: a -> a -> a -> a -> Vec4 a
vec5 :: a -> a -> a -> a -> a -> Vec5 a
vec6 :: a -> a -> a -> a -> a -> a -> Vec6 a
vec7 :: a -> a -> a -> a -> a -> a -> a -> Vec7 a
vec8 :: a -> a -> a -> a -> a -> a -> a -> a -> Vec8 a
vec9 :: a -> a -> a -> a -> a -> a -> a -> a -> a -> Vec9 a
vecVec :: Applicative f => f a -> f a -> f (Vec2 a)
vecVec3 :: Applicative f => f a -> f a -> f a -> f (Vec3 a)
vecVec4 :: Applicative f => f a -> f a -> f a -> f a -> f (Vec4 a)
vecVec5 :: Applicative f => f a -> f a -> f a -> f a -> f a -> f (Vec5 a)
The Vec type class
class (Functor v, Applicative v, Foldable v, Traversable v) => Vec v whereSource
Methods
vecSize :: v a -> IntSource
vecToList :: v a -> [a]Source
vecFromList :: [a] -> v aSource
vecUndef :: v a -> aSource
undefinedVec :: v aSource
show/hide Instances
Vec Empty
Vec v => Vec (Cons v)
Type abbreviations for short vectors
type Vec0 = EmptySource
type Vec1 = Cons Vec0Source
type Vec2 = Cons Vec1Source
type Vec3 = Cons Vec2Source
type Vec4 = Cons Vec3Source
type Vec5 = Cons Vec4Source
type Vec6 = Cons Vec5Source
type Vec7 = Cons Vec6Source
type Vec8 = Cons Vec7Source
type Vec9 = Cons Vec8Source
The constructor types
data Empty a Source
Constructors
Empty
show/hide Instances
data Cons v a Source
Constructors
Cons a (v a)
show/hide Instances
Functor v => Functor (Cons v)
Applicative v => Applicative (Cons v)
Foldable v => Foldable (Cons v)
Traversable v => Traversable (Cons v)
Vec v => Vec (Cons v)
(Vec u, Vec v, VecConcat u v w) => VecConcat (Cons u) v (Cons w)
(Eq a, Eq (v a)) => Eq (Cons v a)
(Fractional a, Fractional (v a), Vec v) => Fractional (Cons v a)
(Num a, Num (v a), Vec v) => Num (Cons v a)
(Ord a, Ord (v a)) => Ord (Cons v a)
(Show a, Vec v) => Show (Cons v a)
(Monoid a, Monoid (v a), Vec v) => Monoid (Cons v a)
(Storable a, Storable (v a), Vec v) => Storable (Cons v a)
consUndefTail :: Vec v => Cons v a -> v aSource
Misc
maybeVecFromList :: Vec f => [a] -> Maybe (f a)Source
Safe version of vecFromList.
transposeVec :: (Vec f, Vec g) => f (g a) -> g (f a)Source
Transpose a Vec of Vecs.
Concatenation
maybeVecConcat :: (Vec f, Vec g, Vec h) => f a -> g a -> Maybe (h a)Source
safe concatenation
unsafeVecConcat :: (Vec f, Vec g, Vec h) => f a -> g a -> h aSource
unsafe concatenation
class (Vec u, Vec v, Vec w) => VecConcat u v w | u v -> w whereSource
concatenation with type class
Methods
vecConcat :: u a -> v a -> w aSource
show/hide Instances
Vec v => VecConcat Empty v v
(Vec u, Vec v, VecConcat u v w) => VecConcat (Cons u) v (Cons w)
Zipping
zipVecWith :: Applicative f => (a -> b -> c) -> f a -> f b -> f cSource
zipVecWith3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f dSource
zipVecWith4 :: Applicative f => (a -> b -> c -> d -> e) -> f a -> f b -> f c -> f d -> f eSource
zipVec :: Applicative f => f a -> f b -> f (a, b)Source
zipVec3 :: Applicative f => f a -> f b -> f c -> f (a, b, c)Source
zipVec4 :: Applicative f => f a -> f b -> f c -> f d -> f (a, b, c, d)Source
Short constructor functions
vec0 :: Vec0 aSource
vec1 :: a -> Vec1 aSource
vec2 :: a -> a -> Vec2 aSource
vec3 :: a -> a -> a -> Vec3 aSource
vec4 :: a -> a -> a -> a -> Vec4 aSource
vec5 :: a -> a -> a -> a -> a -> Vec5 aSource
vec6 :: a -> a -> a -> a -> a -> a -> Vec6 aSource
vec7 :: a -> a -> a -> a -> a -> a -> a -> Vec7 aSource
vec8 :: a -> a -> a -> a -> a -> a -> a -> a -> Vec8 aSource
vec9 :: a -> a -> a -> a -> a -> a -> a -> a -> a -> Vec9 aSource
"veccing"
vecVec :: Applicative f => f a -> f a -> f (Vec2 a)Source
vecVec3 :: Applicative f => f a -> f a -> f a -> f (Vec3 a)Source
vecVec4 :: Applicative f => f a -> f a -> f a -> f a -> f (Vec4 a)Source
vecVec5 :: Applicative f => f a -> f a -> f a -> f a -> f a -> f (Vec5 a)Source
Produced by Haddock version 2.6.1