Safe Haskell | None |
---|---|
Language | Haskell98 |
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)
Example:
vec3 1 2 3 :: Vec3 Int {{ 1,2,3 }} :: Vec3 Int Cons 1 (Cons 2 (Cons 3 Empty)) :: Cons (Cons (Cons Empty)) Int
- 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 :: Tup v => Cons v a -> v a
- 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
Type abbreviations for short vectors
The constructor types
Cons a (v a) |
Functor v => Functor (Cons v) | |
Applicative v => Applicative (Cons v) | |
Foldable v => Foldable (Cons v) | |
Traversable v => Traversable (Cons v) | |
Tup v => Tup (Cons v) | |
(Tup u, Tup v, TupConcat u v w) => TupConcat (Cons u) v (Cons w) | |
(Bounded a, Bounded (v a)) => Bounded (Cons v a) | |
(Eq a, Eq (v a)) => Eq (Cons v a) | |
(Fractional a, Fractional (v a), Tup v) => Fractional (Cons v a) | |
(Num a, Num (v a), Tup v) => Num (Cons v a) | |
(Ord a, Ord (v a)) => Ord (Cons v a) | |
(Show a, Tup v) => Show (Cons v a) | |
(Storable a, Storable (v a), Tup v) => Storable (Cons v a) | |
(Monoid a, Monoid (v a), Tup v) => Monoid (Cons v a) |
consUndefTail :: Tup v => Cons v a -> v a Source
Short constructor functions
"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