Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type family Length cs where ...
- newtype Coord cs = Coord {}
- coordSplit :: Coord (c ': cs) -> (c, Coord cs)
- pattern (:|) :: c -> Coord cs -> Coord (c ': cs)
- pattern EmptyCoord :: Coord '[]
- _WrappedCoord :: Lens' (Coord cs) (NP I cs)
- coordHead :: Lens (Coord (a ': as)) (Coord (a' ': as)) a a'
- coordTail :: Lens (Coord (a ': as)) (Coord (a ': as')) (Coord as) (Coord as')
- singleCoord :: a -> Coord '[a]
- appendCoord :: a -> Coord as -> Coord (a ': as)
- 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]
- tranposeCoord :: Coord '[a, b] -> Coord '[b, a]
- zeroCoord :: All IsCoord cs => Coord cs
- class AllSizedKnown (cs :: [*]) where
- sizeProof :: Dict (KnownNat (MaxCoordSize cs))
- class WeakenCoord as bs where
- weakenCoord :: Coord as -> Maybe (Coord bs)
- class StrengthenCoord as bs where
- strengthenCoord :: Coord as -> Coord bs
Documentation
A multideminsion coordinate
Instances
All Eq cs => Eq (Coord cs) Source # | |
(All Eq cs, All Ord cs) => Ord (Coord cs) Source # | |
Defined in SizedGrid.Coord | |
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 ToJSON cs => ToJSON (Coord cs) Source # | |
Defined in SizedGrid.Coord | |
All FromJSON cs => FromJSON (Coord cs) Source # | |
All Random cs => Random (Coord cs) Source # | |
Defined in SizedGrid.Coord | |
(All AffineSpace cs, AdditiveGroup (CoordDiff cs), IsProductType (CoordDiff cs) (MapDiff cs)) => AffineSpace (Coord cs) Source # | |
All AdditiveGroup cs => AdditiveGroup (Coord cs) Source # | |
(AllSizedKnown cs, All IsCoord cs, All Monoid cs, All Semigroup cs, SListI cs) => ComonadStore (Coord cs) (FocusedGrid cs) Source # | |
Defined in SizedGrid.Grid.Focused pos :: FocusedGrid cs a -> Coord cs # peek :: Coord cs -> FocusedGrid cs a -> a # peeks :: (Coord cs -> Coord cs) -> FocusedGrid cs a -> a # seek :: Coord cs -> FocusedGrid cs a -> FocusedGrid cs a # seeks :: (Coord cs -> Coord cs) -> FocusedGrid cs a -> FocusedGrid cs a # experiment :: Functor f => (Coord cs -> f (Coord cs)) -> FocusedGrid cs a -> f a # | |
All IsCoord cs => FunctorWithIndex (Coord cs) (Grid cs) Source # | |
All IsCoord cs => FoldableWithIndex (Coord cs) (Grid cs) Source # | |
Defined in SizedGrid.Grid.Grid ifoldMap :: Monoid m => (Coord cs -> a -> m) -> Grid cs a -> m # ifolded :: IndexedFold (Coord cs) (Grid cs a) a # ifoldr :: (Coord cs -> a -> b -> b) -> b -> Grid cs a -> b # ifoldl :: (Coord cs -> b -> a -> b) -> b -> Grid cs a -> b # ifoldr' :: (Coord cs -> a -> b -> b) -> b -> Grid cs a -> b # ifoldl' :: (Coord cs -> b -> a -> b) -> b -> Grid cs a -> b # | |
All IsCoord cs => TraversableWithIndex (Coord cs) (Grid cs) Source # | |
Defined in SizedGrid.Grid.Grid itraverse :: Applicative f => (Coord cs -> a -> f b) -> Grid cs a -> f (Grid cs b) # itraversed :: IndexedTraversal (Coord cs) (Grid cs a) (Grid cs b) a b # | |
Field1 (Coord (a ': cs)) (Coord (a' ': cs)) a a' Source # | |
Field2 (Coord (a ': (b ': cs))) (Coord (a ': (b' ': cs))) b b' Source # | |
Field3 (Coord (a ': (b ': (c ': cs)))) (Coord (a ': (b ': (c' ': cs)))) c c' Source # | |
Field4 (Coord (a ': (b ': (c ': (d ': cs))))) (Coord (a ': (b ': (c ': (d' ': cs))))) d d' Source # | |
Field5 (Coord (a ': (b ': (c ': (d ': (e ': cs)))))) (Coord (a ': (b ': (c ': (d ': (e' ': cs)))))) e e' Source # | |
type Rep (Coord cs) Source # | |
Defined in SizedGrid.Coord | |
type Diff (Coord cs) Source # | |
Defined in SizedGrid.Coord |
coordSplit :: Coord (c ': cs) -> (c, Coord cs) Source #
pattern EmptyCoord :: Coord '[] Source #
coordHead :: Lens (Coord (a ': as)) (Coord (a' ': as)) a a' Source #
Get the first element of a coord. Thanks to type level information, we can write this as a total Lens
singleCoord :: a -> Coord '[a] Source #
Turn a single element into a one dimensional Coord
appendCoord :: a -> Coord as -> Coord (a ': as) Source #
Add a new element to a Coord
. This increases the dimensionality
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.
Instances
type CoordDiff ([] :: [k]) Source # | |
Defined in SizedGrid.Coord type CoordDiff ([] :: [k]) = () | |
type CoordDiff (a ': (b ': (c ': (d ': (e ': (f ': ([] :: [Type])))))) :: [Type]) Source # | |
type CoordDiff (a ': (b ': (c ': (d ': (e ': ([] :: [Type]))))) :: [Type]) Source # | |
type CoordDiff (a ': (b ': (c ': (d ': ([] :: [Type])))) :: [Type]) Source # | |
type CoordDiff (a ': (b ': (c ': ([] :: [Type]))) :: [Type]) Source # | |
type CoordDiff (a ': (b ': ([] :: [Type])) :: [Type]) Source # | |
type CoordDiff (a ': ([] :: [Type]) :: [Type]) 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
tranposeCoord :: Coord '[a, b] -> Coord '[b, a] Source #
Swap x and y for a coord in 2D space
class AllSizedKnown (cs :: [*]) where Source #
Instances
AllSizedKnown ([] :: [Type]) Source # | |
Defined in SizedGrid.Coord | |
(KnownNat (CoordSized a), AllSizedKnown as) => AllSizedKnown (a ': as) Source # | |
Defined in SizedGrid.Coord |
class WeakenCoord as bs where Source #
Instances
WeakenCoord ([] :: [Type]) ([] :: [Type]) Source # | |
Defined in SizedGrid.Coord | |
(b ~ CoordFromNat a n, WeakenCoord as bs, IsCoord a, IsCoord (CoordFromNat a n)) => WeakenCoord (a ': as) (b ': bs) Source # | |
Defined in SizedGrid.Coord |
class StrengthenCoord as bs where Source #
strengthenCoord :: Coord as -> Coord bs Source #
Instances
StrengthenCoord ([] :: [Type]) ([] :: [Type]) Source # | |
Defined in SizedGrid.Coord strengthenCoord :: Coord [] -> Coord [] Source # | |
(StrengthenCoord as bs, IsCoord (CoordFromNat a n), IsCoord a, b ~ CoordFromNat a n, CoordSized a <= CoordSized (CoordFromNat a n)) => StrengthenCoord (a ': as) (b ': bs) Source # | |
Defined in SizedGrid.Coord strengthenCoord :: Coord (a ': as) -> Coord (b ': bs) Source # |