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

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
 Source # Instance detailsDefined in SizedGrid.Coord.Class MethodsasOrdinal :: Iso' (Ordinal n) (Ordinal n) Source #zeroPosition :: (1 <= n, KnownNat n) => Ordinal n Source #sCoordSized :: Proxy (Ordinal n) -> Proxy n Source #maxCoordSize :: KnownNat n => Proxy (Ordinal n) -> Integer Source #maxCoord :: KnownNat n => Proxy n -> Ordinal n Source #asSizeProxy :: Ordinal n -> (forall (m :: Nat). (KnownNat m, (m + 1) <= n) => Proxy m -> x) -> x Source #weakenIsCoord :: KnownNat m => Ordinal n -> Maybe (Ordinal m) Source #strengthenIsCoord :: (KnownNat m, n <= m) => Ordinal n -> Ordinal m Source # Source # Instance detailsDefined in SizedGrid.Coord.Periodic MethodsasOrdinal :: Iso' (Periodic n) (Ordinal n) Source #zeroPosition :: (1 <= n, KnownNat n) => Periodic n Source #sCoordSized :: Proxy (Periodic n) -> Proxy n Source #maxCoordSize :: KnownNat n => Proxy (Periodic n) -> Integer Source #maxCoord :: KnownNat n => Proxy n -> Periodic n Source #asSizeProxy :: Periodic n -> (forall (m :: Nat). (KnownNat m, (m + 1) <= n) => Proxy m -> x) -> x Source #weakenIsCoord :: KnownNat m => Periodic n -> Maybe (Periodic m) Source #strengthenIsCoord :: (KnownNat m, n <= m) => Periodic n -> Periodic m Source # Source # Instance detailsDefined in SizedGrid.Coord.HardWrap MethodsasOrdinal :: Iso' (HardWrap n) (Ordinal n) Source #zeroPosition :: (1 <= n, KnownNat n) => HardWrap n Source #sCoordSized :: Proxy (HardWrap n) -> Proxy n Source #maxCoordSize :: KnownNat n => Proxy (HardWrap n) -> Integer Source #maxCoord :: KnownNat n => Proxy n -> HardWrap n Source #asSizeProxy :: HardWrap n -> (forall (m :: Nat). (KnownNat m, (m + 1) <= n) => Proxy m -> x) -> x Source #weakenIsCoord :: KnownNat m => HardWrap n -> Maybe (HardWrap m) Source #strengthenIsCoord :: (KnownNat m, n <= m) => HardWrap n -> HardWrap m Source #

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 detailsDefined in SizedGrid.Coord.Class Associated Typestype 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