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

Safe HaskellNone
LanguageHaskell2010

SizedGrid.Grid.Class

Synopsis

Documentation

class IsGrid cs grid | grid -> cs where Source #

Conversion between Grid and FocusedGrid and access grids at a Coord

Minimal complete definition

gridIndex, asGrid, asFocusedGrid

Methods

gridIndex :: Coord cs -> Lens' (grid a) a Source #

Get the element at a grid location. This is a lens because we know it must exist

asGrid :: Lens' (grid a) (Grid cs a) Source #

Convert to, or run a function over, a Grid

asFocusedGrid :: Lens' (grid a) (FocusedGrid cs a) Source #

Convert to, or run a function over, a FocusedGrid

Instances

(KnownNat (MaxCoordSize * cs), All * IsCoord cs, All * Monoid cs, All * Semigroup cs) => IsGrid cs (FocusedGrid cs) Source # 

Methods

gridIndex :: Coord cs -> Lens' (FocusedGrid cs a) a Source #

asGrid :: Functor f => (Grid cs a -> f (Grid cs a)) -> FocusedGrid cs a -> f (FocusedGrid cs a) Source #

asFocusedGrid :: Functor f => (FocusedGrid cs a -> f (FocusedGrid cs a)) -> FocusedGrid cs a -> f (FocusedGrid cs a) Source #

(KnownNat (MaxCoordSize * cs), All * Semigroup cs, All * Monoid cs, All * IsCoord cs) => IsGrid cs (Grid cs) Source # 

Methods

gridIndex :: Coord cs -> Lens' (Grid cs a) a Source #

asGrid :: Functor f => (Grid cs a -> f (Grid cs a)) -> Grid cs a -> f (Grid cs a) Source #

asFocusedGrid :: Functor f => (FocusedGrid cs a -> f (FocusedGrid cs a)) -> Grid cs a -> f (Grid cs a) Source #