Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Coord (dims :: [Nat]) = Coord {}
- coord :: forall dims. SingI dims => [Int] -> Maybe (Coord dims)
- unconsC :: Coord (n ': ns) -> (Int, Coord ns)
- appendC :: Coord ns -> Coord ms -> Coord (ns ++ ms)
- pattern (:#) :: Int -> Coord ns -> Coord (n ': ns)
- highestIndex :: forall n. KnownNat n => Int
- clamp :: Int -> Int -> Int -> Int
- clampCoord :: forall dims. SingI dims => Coord dims -> Coord dims
- wrapCoord :: forall dims. SingI dims => Coord dims -> Coord dims
- coerceCoordDims :: Coord ns -> Coord ms
- coordInBounds :: forall ns. SingI ns => Coord ns -> Bool
Documentation
newtype Coord (dims :: [Nat]) Source #
The index type for Grid
s.
Instances
IsList (Coord dims) Source # | |
(KnownNat n, Bounded (Coord ns)) => Bounded (Coord (n ': ns)) Source # | |
Bounded (Coord ([] :: [Nat])) Source # | |
(KnownNat x, KnownNat y, Sizable (y ': rest), Bounded (Coord rest), Enum (Coord (y ': rest))) => Enum (Coord (x ': (y ': rest))) Source # | |
Defined in Data.Grid.Internal.Coord succ :: Coord (x ': (y ': rest)) -> Coord (x ': (y ': rest)) # pred :: Coord (x ': (y ': rest)) -> Coord (x ': (y ': rest)) # toEnum :: Int -> Coord (x ': (y ': rest)) # fromEnum :: Coord (x ': (y ': rest)) -> Int # enumFrom :: Coord (x ': (y ': rest)) -> [Coord (x ': (y ': rest))] # enumFromThen :: Coord (x ': (y ': rest)) -> Coord (x ': (y ': rest)) -> [Coord (x ': (y ': rest))] # enumFromTo :: Coord (x ': (y ': rest)) -> Coord (x ': (y ': rest)) -> [Coord (x ': (y ': rest))] # enumFromThenTo :: Coord (x ': (y ': rest)) -> Coord (x ': (y ': rest)) -> Coord (x ': (y ': rest)) -> [Coord (x ': (y ': rest))] # | |
KnownNat n => Enum (Coord (n ': ([] :: [Nat]))) Source # | |
Defined in Data.Grid.Internal.Coord succ :: Coord (n ': []) -> Coord (n ': []) # pred :: Coord (n ': []) -> Coord (n ': []) # toEnum :: Int -> Coord (n ': []) # fromEnum :: Coord (n ': []) -> Int # enumFrom :: Coord (n ': []) -> [Coord (n ': [])] # enumFromThen :: Coord (n ': []) -> Coord (n ': []) -> [Coord (n ': [])] # enumFromTo :: Coord (n ': []) -> Coord (n ': []) -> [Coord (n ': [])] # enumFromThenTo :: Coord (n ': []) -> Coord (n ': []) -> Coord (n ': []) -> [Coord (n ': [])] # | |
Eq (Coord dims) Source # | |
Enum (Coord ns) => Num (Coord ns) Source # | |
Show (Coord dims) Source # | |
type Item (Coord dims) Source # | |
Defined in Data.Grid.Internal.Coord |
coord :: forall dims. SingI dims => [Int] -> Maybe (Coord dims) Source #
Safely construct a Coord
for a given grid size, checking that all
indexes are in range
λ> coord @[3, 3] [1, 2] Just [1, 2] λ> coord @[3, 3] [3, 3] Nothing λ> coord @[3, 3] [1, 2, 3] Nothing
highestIndex :: forall n. KnownNat n => Int Source #
coerceCoordDims :: Coord ns -> Coord ms Source #