linear- Linear Algebra

MaintainerEdward Kmett <>
Safe HaskellTrustworthy



n-D Vectors



data V n a Source


Dim n => Monad (V n) 
Functor (V n) 
Dim n => MonadFix (V n) 
Dim n => Applicative (V n) 
Foldable (V n) 
Traversable (V n) 
Dim n => Distributive (V n) 
Dim n => Representable (V n) 
Dim n => MonadZip (V n) 
Apply (V n) 
Bind (V n) 
Dim n => Additive (V n) 
Dim n => Metric (V n) 
Dim n => Trace (V n) 
Dim n => Affine (V n) 
Eq a => Eq (V n a) 
(Dim n, Fractional a) => Fractional (V n a) 
(Dim n, Num a) => Num (V n a) 
Ord a => Ord (V n a) 
Read a => Read (V n a) 
Show a => Show (V n a) 
Generic (V n a) 
(Dim n, Storable a) => Storable (V n a) 
Ixed (V n a) 
(Dim n, Epsilon a) => Epsilon (V n a) 
Dim n => Dim (V n a) 
Each (V n a) (V n b) a b 

int :: Int -> TypeQ

This can be used to generate a template haskell splice for a type level version of a given int.

This does not use GHC TypeLits, instead it generates a numeric type by hand similar to the ones used in the "Functional Pearl: Implicit Configurations" paper by Oleg Kiselyov and Chung-Chieh Shan.

instance Num (Q Exp) provided in this package allows writing $(3) instead of $(int 3). Sometimes the two will produce the same representation (if compiled without the -DUSE_TYPE_LITS preprocessor directive).

dim :: forall n a. Dim n => V n a -> IntSource

class Dim n whereSource


reflectDim :: p n -> IntSource


Dim n => Dim (V n a) 

reifyDim :: Int -> (forall n. Dim n => Proxy n -> r) -> rSource

reifyVector :: forall a r. Vector a -> (forall n. Dim n => V n a -> r) -> rSource

fromVector :: forall n a. Dim n => Vector a -> Maybe (V n a)Source