Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data C n = C
- newtype Vector d r = Vector {}
- unV :: Lens' (Vector d r) (Vec (ToPeano d) r)
- type Arity n = Arity (ToPeano n)
- type Index' i d = Index (ToPeano i) (ToPeano d)
- element :: forall proxy i d r. (Arity d, Index' i d) => proxy i -> Lens' (Vector d r) r
- element' :: forall d r. (KnownNat d, Arity d) => Int -> Traversal' (Vector d r) r
- vectorFromList :: Arity d => [a] -> Maybe (Vector d a)
- vectorFromListUnsafe :: Arity d => [a] -> Vector d a
- type AlwaysTrueDestruct pd d = (Arity pd, ToPeano d ~ S (ToPeano pd))
- destruct :: AlwaysTrueDestruct predD d => Vector d r -> (r, Vector predD r)
- cross :: Num r => Vector 3 r -> Vector 3 r -> Vector 3 r
- toV3 :: Vector 3 a -> V3 a
- fromV3 :: V3 a -> Vector 3 a
- type AlwaysTrueSnoc d = ToPeano (1 + d) ~ S (ToPeano d)
- snoc :: (AlwaysTrueSnoc d, Arity d) => Vector d r -> r -> Vector (1 + d) r
- init :: AlwaysTrueDestruct predD d => Vector d r -> Vector predD r
- prefix :: Prefix (ToPeano i) (ToPeano d) => Vector d r -> Vector i r
- class Prefix i d where
- imap :: Arity d => (Int -> r -> s) -> Vector d r -> Vector d s
- v2 :: r -> r -> Vector 2 r
- v3 :: r -> r -> r -> Vector 3 r
- _unV2 :: Vector 2 r -> (r, r)
- _unV3 :: Vector 3 r -> (r, r, r)
- pattern Vector2 :: forall r. r -> r -> Vector 2 r
- pattern Vector3 :: forall r. r -> r -> r -> Vector 3 r
Documentation
A proxy which can be used for the coordinates.
d dimensional Vectors
Datatype representing d dimensional vectors. Our implementation wraps the implementation provided by fixed-vector.
Arity d => Functor (Vector d) Source # | |
Arity d => Applicative (Vector d) Source # | |
Arity d => Foldable (Vector d) Source # | |
Arity d => Traversable (Vector d) Source # | |
Arity d => Affine (Vector d) Source # | |
Arity d => Metric (Vector d) Source # | |
Arity d => Additive (Vector d) Source # | |
Arity d => Vector (Vector d) r Source # | |
(Eq r, Arity d) => Eq (Vector d r) Source # | |
(Ord r, Arity d) => Ord (Vector d r) Source # | |
(Show r, Arity d) => Show (Vector d r) Source # | |
Generic (Vector d r) Source # | |
(Arity d, NFData r) => NFData (Vector d r) Source # | |
type Dim (Vector d) Source # | |
type Diff (Vector d) Source # | |
type Rep (Vector d r) Source # | |
element :: forall proxy i d r. (Arity d, Index' i d) => proxy i -> Lens' (Vector d r) r Source #
Lens into the i th element
element' :: forall d r. (KnownNat d, Arity d) => Int -> Traversal' (Vector d r) r Source #
Similar to element
above. Except that we don't have a static guarantee
that the index is in bounds. Hence, we can only return a Traversal
vectorFromListUnsafe :: Arity d => [a] -> Vector d a Source #
destruct :: AlwaysTrueDestruct predD d => Vector d r -> (r, Vector predD r) Source #
Get the head and tail of a vector
cross :: Num r => Vector 3 r -> Vector 3 r -> Vector 3 r Source #
Cross product of two three-dimensional vectors
snoc :: (AlwaysTrueSnoc d, Arity d) => Vector d r -> r -> Vector (1 + d) r Source #
Add an element at the back of the vector
init :: AlwaysTrueDestruct predD d => Vector d r -> Vector predD r Source #
Get a vector of the first d - 1 elements.
prefix :: Prefix (ToPeano i) (ToPeano d) => Vector d r -> Vector i r Source #
Get a prefix of i elements of a vector