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

Safe HaskellNone
LanguageHaskell2010

SizedGrid.Grid.Focused

Synopsis

Documentation

data FocusedGrid cs a Source #

Similar to Grid, but this has a focus on a certain square. Becuase of this we loose some instances, such as Applicative, but we gain a Comonad and ComonadStore instance. We can convert between a focused and unfocused list using facilites in IsGrid

Constructors

FocusedGrid 

Fields

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 #

Functor (FocusedGrid cs) Source # 

Methods

fmap :: (a -> b) -> FocusedGrid cs a -> FocusedGrid cs b #

(<$) :: a -> FocusedGrid cs b -> FocusedGrid cs a #

Foldable (FocusedGrid cs) Source # 

Methods

fold :: Monoid m => FocusedGrid cs m -> m #

foldMap :: Monoid m => (a -> m) -> FocusedGrid cs a -> m #

foldr :: (a -> b -> b) -> b -> FocusedGrid cs a -> b #

foldr' :: (a -> b -> b) -> b -> FocusedGrid cs a -> b #

foldl :: (b -> a -> b) -> b -> FocusedGrid cs a -> b #

foldl' :: (b -> a -> b) -> b -> FocusedGrid cs a -> b #

foldr1 :: (a -> a -> a) -> FocusedGrid cs a -> a #

foldl1 :: (a -> a -> a) -> FocusedGrid cs a -> a #

toList :: FocusedGrid cs a -> [a] #

null :: FocusedGrid cs a -> Bool #

length :: FocusedGrid cs a -> Int #

elem :: Eq a => a -> FocusedGrid cs a -> Bool #

maximum :: Ord a => FocusedGrid cs a -> a #

minimum :: Ord a => FocusedGrid cs a -> a #

sum :: Num a => FocusedGrid cs a -> a #

product :: Num a => FocusedGrid cs a -> a #

Traversable (FocusedGrid cs) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> FocusedGrid cs a -> f (FocusedGrid cs b) #

sequenceA :: Applicative f => FocusedGrid cs (f a) -> f (FocusedGrid cs a) #

mapM :: Monad m => (a -> m b) -> FocusedGrid cs a -> m (FocusedGrid cs b) #

sequence :: Monad m => FocusedGrid cs (m a) -> m (FocusedGrid cs a) #

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

Methods

extract :: FocusedGrid cs a -> a #

duplicate :: FocusedGrid cs a -> FocusedGrid cs (FocusedGrid cs a) #

extend :: (FocusedGrid cs a -> b) -> FocusedGrid cs a -> FocusedGrid cs b #

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

Methods

pos :: FocusedGrid cs a -> Coord cs #

peek :: Coord cs -> FocusedGrid cs a -> a #

peeks :: (Coord cs -> Coord cs) -> FocusedGrid cs a -> a #

seek :: Coord cs -> FocusedGrid cs a -> FocusedGrid cs a #

seeks :: (Coord cs -> Coord cs) -> FocusedGrid cs a -> FocusedGrid cs a #

experiment :: Functor f => (Coord cs -> f (Coord cs)) -> FocusedGrid cs a -> f a #