Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class IsCoord (c :: Nat -> *) where
- asOrdinal :: Iso' (c n) (Ordinal n)
- zeroPosition :: (1 <= n, KnownNat n) => c n
- sCoordSized :: Proxy (c n) -> Proxy n
- maxCoordSize :: KnownNat n => Proxy (c n) -> Integer
- maxCoord :: KnownNat n => Proxy n -> c n
- asSizeProxy :: c n -> (forall m. (KnownNat m, (m + 1) <= n) => Proxy m -> x) -> x
- weakenIsCoord :: KnownNat m => c n -> Maybe (c m)
- strengthenIsCoord :: (KnownNat m, n <= m) => c n -> c m
- class (x ~ CoordContainer x (CoordNat x), 1 <= CoordNat x, IsCoord (CoordContainer x), KnownNat (CoordNat x)) => IsCoordLifted x where
- type CoordContainer x :: Nat -> *
- type CoordNat x :: Nat
- allCoordLike :: (1 <= n, IsCoord c, KnownNat n) => [c n]
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.
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
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