| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
NumHask.Vector
Contents
Description
Two classes are supplied:
- A
Vectorclass, with fixed-length n, where shape is held at the type level. - A
SomeVectorclass, with fixed-length, where shape is held at the value level.
- newtype Vector n a = Vector {}
- data SomeVector a = SomeVector Int (Vector a)
- someVector :: KnownNat r => Vector (r :: Nat) a -> SomeVector a
- unsafeToVector :: SomeVector a -> Vector (r :: Nat) a
- toVector :: forall a r. KnownNat r => SomeVector a -> Maybe (Vector (r :: Nat) a)
- newtype ShapeV = ShapeV {}
Documentation
A one-dimensional array where shape is specified at the type level
The main purpose of this, beyond safe-typing, is to supply the Representable instance with an initial object.
A boxed Vector is used under the hood.
Instances
data SomeVector a Source #
a one-dimensional array where shape is specified at the value level
Constructors
| SomeVector Int (Vector a) |
Instances
| Functor SomeVector Source # | |
| Foldable SomeVector Source # | |
| HasShape SomeVector Source # | |
| IsList (SomeVector a) Source # | |
| Eq a => Eq (SomeVector a) Source # | |
| Ord a => Ord (SomeVector a) Source # | |
| Show a => Show (SomeVector a) Source # | |
| Arbitrary a => Arbitrary (SomeVector a) Source # | |
| type Shape SomeVector Source # | |
| type Item (SomeVector a) Source # | |
Conversion
someVector :: KnownNat r => Vector (r :: Nat) a -> SomeVector a Source #
convert from a Vector to a SomeVector
unsafeToVector :: SomeVector a -> Vector (r :: Nat) a Source #
convert from a SomeVector to a Vector with no shape check
toVector :: forall a r. KnownNat r => SomeVector a -> Maybe (Vector (r :: Nat) a) Source #
convert from a SomeVector to a Vector, checking shape