Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data C (n :: Nat) = C
- newtype Vector (d :: Nat) (r :: *) = Vector {}
- unV :: Lens' (Vector d r) (Vec d r)
- element :: forall proxy i d r. (Arity d, Arity i, (i + 1) <= d) => proxy i -> Lens' (Vector d r) r
- element' :: forall d r. Arity d => Int -> Traversal' (Vector d r) r
- vectorFromList :: Arity d => [a] -> Maybe (Vector d a)
- vectorFromListUnsafe :: Arity d => [a] -> Vector d a
- destruct :: (Arity d, Arity (d + 1), 1 <= (d + 1)) => Vector (d + 1) r -> (r, Vector d r)
- cross :: Num r => Vector 3 r -> Vector 3 r -> Vector 3 r
- toV2 :: Vector 2 a -> V2 a
- toV3 :: Vector 3 a -> V3 a
- fromV3 :: V3 a -> Vector 3 a
- snoc :: (Arity (d + 1), Arity d) => Vector d r -> r -> Vector (d + 1) r
- init :: (Arity d, Arity (d + 1)) => Vector (d + 1) r -> Vector d r
- last :: forall d r. (Arity d, Arity (d + 1)) => Vector (d + 1) r -> r
- prefix :: forall i d r. (Arity d, Arity i, i <= d) => Vector d r -> Vector i r
- 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 :: r -> r -> Vector 2 r
- pattern Vector3 :: r -> r -> r -> Vector 3 r
- pattern Vector4 :: r -> r -> r -> r -> Vector 4 r
Documentation
A proxy which can be used for the coordinates.
d dimensional Vectors
newtype Vector (d :: Nat) (r :: *) Source #
Datatype representing d dimensional vectors. Our implementation wraps the implementation provided by fixed-vector.
Instances
element :: forall proxy i d r. (Arity d, Arity i, (i + 1) <= d) => proxy i -> Lens' (Vector d r) r Source #
Lens into the i th element
element' :: forall d r. 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 :: (Arity d, Arity (d + 1), 1 <= (d + 1)) => Vector (d + 1) r -> (r, Vector d 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 :: (Arity (d + 1), Arity d) => Vector d r -> r -> Vector (d + 1) r Source #
Add an element at the back of the vector
init :: (Arity d, Arity (d + 1)) => Vector (d + 1) r -> Vector d r Source #
Get a vector of the first d - 1 elements.
prefix :: forall i d r. (Arity d, Arity i, i <= d) => Vector d r -> Vector i r Source #
Get a prefix of i elements of a vector