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 |
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. KnownNat n => Proxy n -> r) -> r
- reifyVectorNat :: forall a r. Vector a -> (forall n. 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
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).
reflectDim :: p n -> Int Source #