fixed-vector-0.5.1.2: Generic vectors with statically known size.

Safe HaskellNone

Data.Vector.Fixed.Monomorphic

Contents

Description

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.

Synopsis

Vector type class

Vector size

type family DimMono v :: *Source

Dimensions of monomorphic vector.

data Z Source

Type level zero

Instances

Typeable Z 
Arity Z 
Arity n => Index Z (S n) 

data S n Source

Successor of n

Instances

Typeable1 S 
Arity n => Index Z (S n) 
Arity n => Arity (S n) 
Index k n => Index (S k) (S n) 

Synonyms for small numerals

type N1 = S ZSource

type N2 = S N1Source

type N3 = S N2Source

type N4 = S N3Source

type N5 = S N4Source

type N6 = S N5Source

Type class

class Arity (DimMono v) => VectorMono v whereSource

Counterpart of Vector type class for monomorphic vectors.

Associated Types

type VectorElm v :: *Source

Type of vector elements.

Methods

construct :: Fun (DimMono v) (VectorElm v) vSource

Construct vector

inspect :: v -> Fun (DimMono v) (VectorElm v) r -> rSource

Inspect vector

basicIndex :: v -> Int -> VectorElm vSource

Optional more efficient implementation of indexing

class Arity n Source

Type class for handling n-ary functions.

Instances

Arity Z 
Arity n => Arity (S n) 

newtype Fun n a b Source

Newtype wrapper which is used to make Fn injective. It's also a reader monad.

Constructors

Fun 

Fields

unFun :: Fn n a b
 

Instances

Arity n => Monad (Fun n a) 
Arity n => Functor (Fun n a) 
Arity n => Applicative (Fun n a) 

length :: Arity (DimMono v) => v -> IntSource

Length of vector

Constructors

mk1 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N1) => a -> vSource

mk2 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N2) => a -> a -> vSource

mk3 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N3) => a -> a -> a -> vSource

mk4 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N4) => a -> a -> a -> a -> vSource

mk5 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ N5) => a -> a -> a -> a -> a -> vSource

Functions

replicate :: (VectorMono v, VectorElm v ~ a) => a -> vSource

replicateM :: (VectorMono v, VectorElm v ~ a, Monad m) => m a -> m vSource

generate :: (VectorMono v, VectorElm v ~ a) => (Int -> a) -> vSource

generateM :: (Monad m, VectorMono v, VectorElm v ~ a) => (Int -> m a) -> m vSource

unfoldr :: (VectorMono v, VectorElm v ~ a) => (b -> (a, b)) -> b -> vSource

basis :: (VectorMono v, VectorElm v ~ a, Num a) => Int -> vSource

Modifying vectors

Transformations

head :: (VectorMono v, VectorElm v ~ a, DimMono v ~ S n) => v -> aSource

tail :: (VectorMono v, VectorElm v ~ a, VectorMono w, VectorElm w ~ a, DimMono v ~ S (DimMono w)) => v -> wSource

reverse :: VectorMono v => v -> vSource

(!) :: (VectorMono v, VectorElm v ~ a) => v -> Int -> aSource

Comparison

eq :: (VectorMono v, VectorElm v ~ a, Eq a) => v -> v -> BoolSource

Maps

map :: (VectorMono v, VectorElm v ~ a) => (a -> a) -> v -> vSource

mapM :: (VectorMono v, VectorElm v ~ a, Monad m) => (a -> m a) -> v -> m vSource

mapM_ :: (VectorMono v, VectorElm v ~ a, Monad m) => (a -> m b) -> v -> m ()Source

imap :: (VectorMono v, VectorElm v ~ a) => (Int -> a -> a) -> v -> vSource

imapM :: (VectorMono v, VectorElm v ~ a, Monad m) => (Int -> a -> m a) -> v -> m vSource

imapM_ :: (VectorMono v, VectorElm v ~ a, Monad m) => (Int -> a -> m b) -> v -> m ()Source

Folding

foldl :: (VectorMono v, VectorElm v ~ a) => (b -> a -> b) -> b -> v -> bSource

foldr :: (VectorMono v, VectorElm v ~ a) => (a -> b -> b) -> b -> v -> bSource

foldl1 :: (VectorMono v, VectorElm v ~ a, DimMono v ~ S n) => (a -> a -> a) -> v -> aSource

ifoldl :: (VectorMono v, VectorElm v ~ a) => (b -> Int -> a -> b) -> b -> v -> bSource

ifoldr :: (VectorMono v, VectorElm v ~ a) => (Int -> a -> b -> b) -> b -> v -> bSource

foldMap :: (VectorMono v, Monoid m) => (VectorElm v -> m) -> v -> mSource

foldM :: (VectorMono v, VectorElm v ~ a, Monad m) => (b -> a -> m b) -> b -> v -> m bSource

ifoldM :: (VectorMono v, VectorElm v ~ a, Monad m) => (b -> Int -> a -> m b) -> b -> v -> m bSource

Special folds

sum :: (VectorMono v, VectorElm v ~ a, Num a) => v -> aSource

maximum :: (VectorMono v, VectorElm v ~ a, DimMono v ~ S n, Ord a) => v -> aSource

minimum :: (VectorMono v, VectorElm v ~ a, DimMono v ~ S n, Ord a) => v -> aSource

and :: (VectorMono v, VectorElm v ~ Bool) => v -> BoolSource

or :: (VectorMono v, VectorElm v ~ Bool) => v -> BoolSource

all :: (VectorMono v, VectorElm v ~ a) => (a -> Bool) -> v -> BoolSource

any :: (VectorMono v, VectorElm v ~ a) => (a -> Bool) -> v -> BoolSource

Zips

zipWith :: (VectorMono v, VectorElm v ~ a) => (a -> a -> a) -> v -> v -> vSource

zipWithM :: (VectorMono v, VectorElm v ~ a, Monad m) => (a -> a -> m a) -> v -> v -> m vSource

izipWith :: (VectorMono v, VectorElm v ~ a) => (Int -> a -> a -> a) -> v -> v -> vSource

izipWithM :: (VectorMono v, VectorElm v ~ a, Monad m) => (Int -> a -> a -> m a) -> v -> v -> m vSource

Conversion

toList :: (VectorMono v, VectorElm v ~ a) => v -> [a]Source

fromList :: (VectorMono v, VectorElm v ~ a) => [a] -> vSource