| Copyright | (C) 2012-2015 Edward Kmett |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Trustworthy |
| Language | Haskell98 |
Linear.V
Description
n-D Vectors
- newtype V n a = V {}
- int :: Int -> TypeQ
- dim :: forall n a. Dim n => V n a -> Int
- class Dim n where
- reifyDim :: Int -> (forall (n :: *). Dim n => Proxy n -> r) -> r
- reifyVector :: forall a r. Vector a -> (forall (n :: *). Dim n => V n a -> r) -> r
- reifyDimNat :: Int -> (forall (n :: Nat). KnownNat n => Proxy n -> r) -> r
- reifyVectorNat :: forall a r. Vector a -> (forall (n :: Nat). KnownNat n => V n a -> r) -> r
- fromVector :: forall n a. Dim n => Vector a -> Maybe (V n a)
- class Finite v where
- _V :: (Finite u, Finite v) => Iso (V (Size u) a) (V (Size v) b) (u a) (v b)
- _V' :: Finite v => Iso (V (Size v) a) (V (Size v) b) (v a) (v b)
Documentation
Instances
| FunctorWithIndex Int (V k n) # | |
| FoldableWithIndex Int (V k n) # | |
| TraversableWithIndex Int (V k n) # | |
| (Dim k n, Unbox a) => Vector Vector (V k n a) # | |
| (Dim k n, Unbox a) => MVector MVector (V k n a) # | |
| Generic1 * (V k n) # | |
| Dim k n => Dim * (V k n a) # | |
| Dim k n => Monad (V k n) # | |
| Functor (V k n) # | |
| Dim k n => MonadFix (V k n) # | |
| Dim k n => Applicative (V k n) # | |
| Foldable (V k n) # | |
| Traversable (V k n) # | |
| Dim k n => Distributive (V k n) # | |
| Dim k n => Representable (V k n) # | |
| Eq1 (V k n) # | |
| Ord1 (V k n) # | |
| Dim k n => Read1 (V k n) # | |
| Show1 (V k n) # | |
| Dim k n => MonadZip (V k n) # | |
| Dim k n => Serial1 (V k n) # | |
| Dim k n => Hashable1 (V k n) # | |
| Apply (V k n) # | |
| Bind (V k n) # | |
| Dim k n => Additive (V k n) # | |
| Dim k n => Metric (V k n) # | |
| Finite (V Nat n) # | |
| Dim k n => Trace (V k n) # | |
| Dim * n => Affine (V * n) # | |
| (Bounded a, Dim k n) => Bounded (V k n a) # | |
| Eq a => Eq (V k n a) # | |
| (Dim k n, Floating a) => Floating (V k n a) # | |
| (Dim k n, Fractional a) => Fractional (V k n a) # | |
| (Typeable (* -> *) (V k n), Typeable * (V k n a), Dim k n, Data a) => Data (V k n a) # | |
| (Dim k n, Num a) => Num (V k n a) # | |
| Ord a => Ord (V k n a) # | |
| Read a => Read (V k n a) # | |
| Show a => Show (V k n a) # | |
| Generic (V k n a) # | |
| (Dim k n, Storable a) => Storable (V k n a) # | |
| (Dim k n, Binary a) => Binary (V k n a) # | |
| (Dim k n, Serial a) => Serial (V k n a) # | |
| (Dim k n, Serialize a) => Serialize (V k n a) # | |
| NFData a => NFData (V k n a) # | |
| Hashable a => Hashable (V k n a) # | |
| (Dim k n, Unbox a) => Unbox (V k n a) # | |
| Ixed (V k n a) # | |
| (Dim k n, Epsilon a) => Epsilon (V k n a) # | |
| Each (V k n a) (V k n b) a b # | |
| (<=) 1 n => Field1 (V Nat n a) (V Nat n a) a a # | |
| (<=) 2 n => Field2 (V Nat n a) (V Nat n a) a a # | |
| (<=) 3 n => Field3 (V Nat n a) (V Nat n a) a a # | |
| (<=) 4 n => Field4 (V Nat n a) (V Nat n a) a a # | |
| (<=) 5 n => Field5 (V Nat n a) (V Nat n a) a a # | |
| (<=) 6 n => Field6 (V Nat n a) (V Nat n a) a a # | |
| (<=) 7 n => Field7 (V Nat n a) (V Nat n a) a a # | |
| (<=) 8 n => Field8 (V Nat n a) (V Nat n a) a a # | |
| (<=) 9 n => Field9 (V Nat n a) (V Nat n a) a a # | |
| (<=) 10 n => Field10 (V Nat n a) (V Nat n a) a a # | |
| (<=) 11 n => Field11 (V Nat n a) (V Nat n a) a a # | |
| (<=) 12 n => Field12 (V Nat n a) (V Nat n a) a a # | |
| (<=) 13 n => Field13 (V Nat n a) (V Nat n a) a a # | |
| (<=) 14 n => Field14 (V Nat n a) (V Nat n a) a a # | |
| (<=) 15 n => Field15 (V Nat n a) (V Nat n a) a a # | |
| (<=) 16 n => Field16 (V Nat n a) (V Nat n a) a a # | |
| (<=) 17 n => Field17 (V Nat n a) (V Nat n a) a a # | |
| (<=) 18 n => Field18 (V Nat n a) (V Nat n a) a a # | |
| (<=) 19 n => Field19 (V Nat n a) (V Nat n a) a a # | |
| data MVector s (V k n a) # | |
| type Rep1 * (V k n) # | |
| type Rep (V k n) # | |
| type Size (V Nat n) # | |
| type Diff (V * n) # | |
| type Rep (V k n a) # | |
| data Vector (V k n a) # | |
| type Index (V k n a) # | |
| type IxValue (V k n a) # | |
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).
Minimal complete definition
Methods
reflectDim :: p n -> Int #