Safe Haskell | None |
---|---|
Language | Haskell98 |
Wrapper function for working with monomorphic vectors. Standard API require vector to be parametric in their element type making it impossible to work with vectors like
data Vec3 = Vec3 Double Double Double
This module provides newtype wrapper which allows use of functions from Data.Vector.Fixed with such data types and function which works with such vectors.
Functions have same meaning as ones from Data.Vector.Fixed and documented there.
- type family DimMono v :: *
- data Z
- data S n
- type N1 = S Z
- type N2 = S N1
- type N3 = S N2
- type N4 = S N3
- type N5 = S N4
- type N6 = S N5
- class Arity (DimMono v) => VectorMono v where
- class Arity n
- newtype Fun n a b = Fun {}
- length :: Arity (DimMono v) => v -> Int
- mk1 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N1) => a -> v
- mk2 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N2) => a -> a -> v
- mk3 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N3) => a -> a -> a -> v
- mk4 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N4) => a -> a -> a -> a -> v
- mk5 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N5) => a -> a -> a -> a -> a -> v
- replicate :: (VectorMono v, VectorElm v ~ a) => a -> v
- replicateM :: (VectorMono v, VectorElm v ~ a, Monad m) => m a -> m v
- generate :: (VectorMono v, VectorElm v ~ a) => (Int -> a) -> v
- generateM :: (Monad m, VectorMono v, VectorElm v ~ a) => (Int -> m a) -> m v
- unfoldr :: (VectorMono v, VectorElm v ~ a) => (b -> (a, b)) -> b -> v
- basis :: (VectorMono v, VectorElm v ~ a, Num a) => Int -> v
- head :: (VectorMono v, VectorElm v ~ a, DimMono v ~ S n) => v -> a
- tail :: (VectorMono v, VectorElm v ~ a, VectorMono w, VectorElm w ~ a, DimMono v ~ S (DimMono w)) => v -> w
- reverse :: VectorMono v => v -> v
- (!) :: (VectorMono v, VectorElm v ~ a) => v -> Int -> a
- eq :: (VectorMono v, VectorElm v ~ a, Eq a) => v -> v -> Bool
- map :: (VectorMono v, VectorElm v ~ a) => (a -> a) -> v -> v
- mapM :: (VectorMono v, VectorElm v ~ a, Monad m) => (a -> m a) -> v -> m v
- mapM_ :: (VectorMono v, VectorElm v ~ a, Monad m) => (a -> m b) -> v -> m ()
- imap :: (VectorMono v, VectorElm v ~ a) => (Int -> a -> a) -> v -> v
- imapM :: (VectorMono v, VectorElm v ~ a, Monad m) => (Int -> a -> m a) -> v -> m v
- imapM_ :: (VectorMono v, VectorElm v ~ a, Monad m) => (Int -> a -> m b) -> v -> m ()
- foldl :: (VectorMono v, VectorElm v ~ a) => (b -> a -> b) -> b -> v -> b
- foldr :: (VectorMono v, VectorElm v ~ a) => (a -> b -> b) -> b -> v -> b
- foldl1 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ S n) => (a -> a -> a) -> v -> a
- ifoldl :: (VectorMono v, VectorElm v ~ a) => (b -> Int -> a -> b) -> b -> v -> b
- ifoldr :: (VectorMono v, VectorElm v ~ a) => (Int -> a -> b -> b) -> b -> v -> b
- fold :: (VectorMono v, Monoid (VectorElm v)) => v -> VectorElm v
- foldMap :: (VectorMono v, Monoid m) => (VectorElm v -> m) -> v -> m
- foldM :: (VectorMono v, VectorElm v ~ a, Monad m) => (b -> a -> m b) -> b -> v -> m b
- ifoldM :: (VectorMono v, VectorElm v ~ a, Monad m) => (b -> Int -> a -> m b) -> b -> v -> m b
- sum :: (VectorMono v, VectorElm v ~ a, Num a) => v -> a
- maximum :: (VectorMono v, VectorElm v ~ a, DimMono v ~ S n, Ord a) => v -> a
- minimum :: (VectorMono v, VectorElm v ~ a, DimMono v ~ S n, Ord a) => v -> a
- and :: (VectorMono v, VectorElm v ~ Bool) => v -> Bool
- or :: (VectorMono v, VectorElm v ~ Bool) => v -> Bool
- all :: (VectorMono v, VectorElm v ~ a) => (a -> Bool) -> v -> Bool
- any :: (VectorMono v, VectorElm v ~ a) => (a -> Bool) -> v -> Bool
- find :: (VectorMono v, VectorElm v ~ a) => (a -> Bool) -> v -> Maybe a
- zipWith :: (VectorMono v, VectorElm v ~ a) => (a -> a -> a) -> v -> v -> v
- zipWithM :: (VectorMono v, VectorElm v ~ a, Monad m) => (a -> a -> m a) -> v -> v -> m v
- izipWith :: (VectorMono v, VectorElm v ~ a) => (Int -> a -> a -> a) -> v -> v -> v
- izipWithM :: (VectorMono v, VectorElm v ~ a, Monad m) => (Int -> a -> a -> m a) -> v -> v -> m v
- convert :: (VectorMono v, VectorMono w, VectorElm v ~ VectorElm w, DimMono v ~ DimMono w) => v -> w
- toList :: (VectorMono v, VectorElm v ~ a) => v -> [a]
- fromList :: (VectorMono v, VectorElm v ~ a) => [a] -> v
Vector type class
Vector size
Type level zero
Successor of n
Synonyms for small numerals
Type class
class Arity (DimMono v) => VectorMono v where Source #
Counterpart of Vector
type class for monomorphic vectors.
Type class for handling n-ary functions.
Newtype wrapper which is used to make Fn
injective. It's also a
reader monad.
Constructors
Functions
replicate :: (VectorMono v, VectorElm v ~ a) => a -> v Source #
replicateM :: (VectorMono v, VectorElm v ~ a, Monad m) => m a -> m v Source #
unfoldr :: (VectorMono v, VectorElm v ~ a) => (b -> (a, b)) -> b -> v Source #
Modifying vectors
Transformations
tail :: (VectorMono v, VectorElm v ~ a, VectorMono w, VectorElm w ~ a, DimMono v ~ S (DimMono w)) => v -> w Source #
reverse :: VectorMono v => v -> v Source #
Comparison
Maps
map :: (VectorMono v, VectorElm v ~ a) => (a -> a) -> v -> v Source #
Folding
foldl :: (VectorMono v, VectorElm v ~ a) => (b -> a -> b) -> b -> v -> b Source #
foldr :: (VectorMono v, VectorElm v ~ a) => (a -> b -> b) -> b -> v -> b Source #
ifoldM :: (VectorMono v, VectorElm v ~ a, Monad m) => (b -> Int -> a -> m b) -> b -> v -> m b Source #
Special folds
Zips
zipWith :: (VectorMono v, VectorElm v ~ a) => (a -> a -> a) -> v -> v -> v Source #
izipWithM :: (VectorMono v, VectorElm v ~ a, Monad m) => (Int -> a -> a -> m a) -> v -> v -> m v Source #
Conversion
convert :: (VectorMono v, VectorMono w, VectorElm v ~ VectorElm w, DimMono v ~ DimMono w) => v -> w Source #
toList :: (VectorMono v, VectorElm v ~ a) => v -> [a] Source #
fromList :: (VectorMono v, VectorElm v ~ a) => [a] -> v Source #