Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type family Length cs where ...
- newtype Coord cs = Coord {}
- type family CoordDiff (cs :: [k]) :: *
- type family MapDiff xs where ...
- allCoord :: forall cs. All IsCoord cs => [Coord cs]
- type family MaxCoordSize (cs :: [k]) :: Nat where ...
- coordPosition :: All IsCoord cs => Coord cs -> Int
- type family AllDiffSame a xs :: Constraint where ...
- moorePoints :: forall a cs. (Enum a, Num a, AllDiffSame a cs, All AffineSpace cs) => a -> Coord cs -> [Coord cs]
- vonNeumanPoints :: forall a cs. (Enum a, Num a, Ord a, All Integral (MapDiff cs), AllDiffSame a cs, All AffineSpace cs, Ord (CoordDiff cs), IsProductType (CoordDiff cs) (MapDiff cs), AdditiveGroup (CoordDiff cs)) => a -> Coord cs -> [Coord cs]
Documentation
A multideminsion coordinate
All * Eq cs => Eq (Coord cs) Source # | |
(All * Eq cs, All * Ord cs) => Ord (Coord cs) Source # | |
All * Show cs => Show (Coord cs) Source # | |
Generic (Coord cs) Source # | |
All * Semigroup cs => Semigroup (Coord cs) Source # | |
(All * Semigroup cs, All * Monoid cs) => Monoid (Coord cs) Source # | |
All * Random cs => Random (Coord cs) Source # | |
All * ToJSON cs => ToJSON (Coord cs) Source # | |
All * FromJSON cs => FromJSON (Coord cs) Source # | |
All * AdditiveGroup cs => AdditiveGroup (Coord cs) Source # | |
(All * AffineSpace cs, AdditiveGroup (CoordDiff * cs), IsProductType (CoordDiff * cs) (MapDiff cs)) => AffineSpace (Coord cs) Source # | |
All * IsCoord cs => TraversableWithIndex (Coord cs) (Grid cs) | |
All * IsCoord cs => FunctorWithIndex (Coord cs) (Grid cs) | |
All * IsCoord cs => FoldableWithIndex (Coord cs) (Grid cs) | |
(KnownNat (MaxCoordSize * cs), All * IsCoord cs, All * Monoid cs, All * Semigroup cs, SListI * cs) => ComonadStore (Coord cs) (FocusedGrid cs) | |
type Rep (Coord cs) Source # | |
type Diff (Coord cs) Source # | |
type family CoordDiff (cs :: [k]) :: * Source #
The type of difference between two coords. A n-dimensional coord should have a Diff
of an n-tuple of Integers
. We use Identity
and our 1-tuple. Unfortuantly, each instance is manual at the moment.
type CoordDiff k ([] k) Source # | |
type CoordDiff * ((:) * a ((:) * b ((:) * c ((:) * d ((:) * e ((:) * f ([] *))))))) Source # | |
type CoordDiff * ((:) * a ((:) * b ((:) * c ((:) * d ((:) * e ([] *)))))) Source # | |
type CoordDiff * ((:) * a ((:) * b ((:) * c ((:) * d ([] *))))) Source # | |
type CoordDiff * ((:) * a ((:) * b ((:) * c ([] *)))) Source # | |
type CoordDiff * ((:) * a ((:) * b ([] *))) Source # | |
type CoordDiff * ((:) * a ([] *)) Source # | |
type family MapDiff xs where ... Source #
Apply Diff
to each element of a type level list. This is required as type families can't be partially applied.
type family MaxCoordSize (cs :: [k]) :: Nat where ... Source #
The number of elements a coord can have. This is equal to the product of the CoordSized
of each element
MaxCoordSize '[] = 1 | |
MaxCoordSize (c ': cs) = CoordSized c * MaxCoordSize cs |
coordPosition :: All IsCoord cs => Coord cs -> Int Source #
Convert a Coord
to its position in a vector
type family AllDiffSame a xs :: Constraint where ... Source #
All Diffs of the members of the list must be equal
AllDiffSame _ '[] = () | |
AllDiffSame a (x ': xs) = (Diff x ~ a, AllDiffSame a xs) |
moorePoints :: forall a cs. (Enum a, Num a, AllDiffSame a cs, All AffineSpace cs) => a -> Coord cs -> [Coord cs] Source #
Calculate the Moore neighbourhood around a point. Includes the center
vonNeumanPoints :: forall a cs. (Enum a, Num a, Ord a, All Integral (MapDiff cs), AllDiffSame a cs, All AffineSpace cs, Ord (CoordDiff cs), IsProductType (CoordDiff cs) (MapDiff cs), AdditiveGroup (CoordDiff cs)) => a -> Coord cs -> [Coord cs] Source #
Calculate the von Neuman neighbourhood around a point. Includes the center