sized-grid-0.2.0.1: Multidimensional grids with sized specified at compile time

Safe HaskellNone
LanguageHaskell2010

SizedGrid.Coord.Class

Synopsis

Documentation

class IsCoord (c :: Nat -> *) where Source #

Everything that can be uses as a Coordinate. The only required function is asOrdinal and the type instance of CoordSized: the rest can be derived automatically.

Minimal complete definition

asOrdinal

Methods

asOrdinal :: Iso' (c n) (Ordinal n) Source #

As each coord represents a finite number of states, it must be isomorphic to an Ordinal

zeroPosition :: (1 <= n, KnownNat n) => c n Source #

The origin. If c is an instance of Monoid, this should be mempty

zeroPosition :: Monoid (c n) => c n Source #

The origin. If c is an instance of Monoid, this should be mempty

sCoordSized :: Proxy (c n) -> Proxy n Source #

Retrive a Proxy of the size

maxCoordSize :: KnownNat n => Proxy (c n) -> Integer Source #

The largest possible number expressable

maxCoord :: KnownNat n => Proxy n -> c n Source #

The maximum value of a coord

asSizeProxy :: c n -> (forall m. (KnownNat m, (m + 1) <= n) => Proxy m -> x) -> x Source #

weakenIsCoord :: KnownNat m => c n -> Maybe (c m) Source #

strengthenIsCoord :: (KnownNat m, n <= m) => c n -> c m Source #

Instances
IsCoord Ordinal Source # 
Instance details

Defined in SizedGrid.Coord.Class

IsCoord Periodic Source # 
Instance details

Defined in SizedGrid.Coord.Periodic

IsCoord HardWrap Source # 
Instance details

Defined in SizedGrid.Coord.HardWrap

class (x ~ CoordContainer x (CoordNat x), 1 <= CoordNat x, IsCoord (CoordContainer x), KnownNat (CoordNat x)) => IsCoordLifted x Source #

Sometimes it useful to work with Coords of type *, not Nat -> *. This is away of doing so. | | It should be autogenerated for all valid instances of IsCoord

Associated Types

type CoordContainer x :: Nat -> * Source #

type CoordNat x :: Nat Source #

Instances
(KnownNat n, 1 <= n, IsCoord c) => IsCoordLifted (c n) Source # 
Instance details

Defined in SizedGrid.Coord.Class

Associated Types

type CoordContainer (c n) :: Nat -> Type Source #

type CoordNat (c n) :: Nat Source #

allCoordLike :: (1 <= n, IsCoord c, KnownNat n) => [c n] Source #

Enumerate all possible values of a coord, in order