Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class (1 <= CoordSized c, KnownNat (CoordSized c)) => IsCoord c where
- type CoordSized c :: Nat
- allCoordLike :: IsCoord c => [c]
Documentation
class (1 <= CoordSized c, KnownNat (CoordSized c)) => IsCoord c 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.
This is kind * -> Constraint for ease of use later. There is some argument that it should be of kind (Nat -> *) -> Constraint and we could remove CoordSized
, but that has other complications
type CoordSized c :: Nat Source #
The maximum number of values that a Coord can take
asOrdinal :: Iso' c (Ordinal (CoordSized c)) Source #
As each coord represents a finite number of states, it must be isomorphic to an Ordinal
zeroPosition :: c Source #
The origin. If c is an instance of Monoid
, this should be mempty
zeroPosition :: Monoid c => c Source #
The origin. If c is an instance of Monoid
, this should be mempty
sCoordSized :: proxy c -> Proxy (CoordSized c) Source #
Retrive a Proxy
of the size
maxCoordSize :: proxy c -> Integer Source #
The largest possible number expressable
allCoordLike :: IsCoord c => [c] Source #
Enumerate all possible values of a coord, in order