Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type One = S Z
- type Two = S One
- type Three = S Two
- type Four = S Three
- type Many d = S (S (S (S (S d))))
- type family FromPeano (d :: PeanoNum) :: Nat where ...
- data SingPeano (d :: PeanoNum) where
- class ImplicitPeano (d :: PeanoNum) where
- implicitPeano :: SingPeano d
- newtype VectorFamily (d :: PeanoNum) (r :: *) = VectorFamily {
- _unVF :: VectorFamilyF d r
- type family VectorFamilyF (d :: PeanoNum) :: * -> * where ...
- unVF :: Lens (VectorFamily d r) (VectorFamily d t) (VectorFamilyF d r) (VectorFamilyF d t)
- type ImplicitArity d = (ImplicitPeano d, Arity (FromPeano d))
- element' :: forall d r. ImplicitArity d => Int -> Traversal' (VectorFamily d r) r
- elem0 :: Int -> Traversal' (VectorFamily Z r) r
- elem1 :: Int -> Traversal' (VectorFamily One r) r
- elem2 :: Int -> Traversal' (VectorFamily Two r) r
- elem3 :: Int -> Traversal' (VectorFamily Three r) r
- elem4 :: Int -> Traversal' (VectorFamily Four r) r
- elemD :: Arity (FromPeano (Many d)) => Int -> Traversal' (VectorFamily (Many d) r) r
- vectorFromList :: ImplicitArity d => [r] -> Maybe (VectorFamily d r)
- vectorFromListUnsafe :: ImplicitArity d => [r] -> VectorFamily d r
- destruct :: (ImplicitArity d, ImplicitArity (S d)) => VectorFamily (S d) r -> (r, VectorFamily d r)
- snoc :: (ImplicitArity d, ImplicitArity (S d), (1 + FromPeano d) ~ (FromPeano d + 1)) => VectorFamily d r -> r -> VectorFamily (S d) r
Natural number stuff
class ImplicitPeano (d :: PeanoNum) where Source #
implicitPeano :: SingPeano d Source #
Instances
ImplicitPeano Z Source # | |
Defined in Data.Geometry.Vector.VectorFamilyPeano | |
ImplicitPeano d => ImplicitPeano (S d) Source # | |
Defined in Data.Geometry.Vector.VectorFamilyPeano implicitPeano :: SingPeano (S d) Source # |
d dimensional Vectors
newtype VectorFamily (d :: PeanoNum) (r :: *) Source #
Datatype representing d dimensional vectors. The default implementation is based n VectorFixed. However, for small vectors we automatically select a more efficient representation.
VectorFamily | |
|
Instances
type family VectorFamilyF (d :: PeanoNum) :: * -> * where ... Source #
Mapping between the implementation type, and the actual implementation.
VectorFamilyF Z = Const () | |
VectorFamilyF One = Identity | |
VectorFamilyF Two = V2 | |
VectorFamilyF Three = V3 | |
VectorFamilyF Four = V4 | |
VectorFamilyF (Many d) = Vector (FromPeano (Many d)) |
unVF :: Lens (VectorFamily d r) (VectorFamily d t) (VectorFamilyF d r) (VectorFamilyF d t) Source #
type ImplicitArity d = (ImplicitPeano d, Arity (FromPeano d)) Source #
element' :: forall d r. ImplicitArity d => Int -> Traversal' (VectorFamily d r) r Source #
elem0 :: Int -> Traversal' (VectorFamily Z r) r Source #
elem1 :: Int -> Traversal' (VectorFamily One r) r Source #
elem2 :: Int -> Traversal' (VectorFamily Two r) r Source #
elem3 :: Int -> Traversal' (VectorFamily Three r) r Source #
elem4 :: Int -> Traversal' (VectorFamily Four r) r Source #
elemD :: Arity (FromPeano (Many d)) => Int -> Traversal' (VectorFamily (Many d) r) r Source #
vectorFromList :: ImplicitArity d => [r] -> Maybe (VectorFamily d r) Source #
vectorFromListUnsafe :: ImplicitArity d => [r] -> VectorFamily d r Source #
destruct :: (ImplicitArity d, ImplicitArity (S d)) => VectorFamily (S d) r -> (r, VectorFamily d r) Source #
Get the head and tail of a vector
snoc :: (ImplicitArity d, ImplicitArity (S d), (1 + FromPeano d) ~ (FromPeano d + 1)) => VectorFamily d r -> r -> VectorFamily (S d) r Source #