grid-7.8.12: Tools for working with regular grids (graphs, lattices).

Copyright(c) Amy de Buitléir 2012-2017
LicenseBSD-style
Maintaineramy@nualeargais.ie
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Math.Geometry.GridMap.Lazy

Description

Ordered maps from tiles on a grid to values. This module is a wrapper around Grid and Map, in order to combine the functionality of grids and maps into a single type.

Synopsis

Documentation

data LGridMap g v Source #

A map from tile positions in a grid to values.

Instances
(Grid g, Ord (Index g)) => Functor (LGridMap g) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

Methods

fmap :: (a -> b) -> LGridMap g a -> LGridMap g b #

(<$) :: a -> LGridMap g b -> LGridMap g a #

Foldable (LGridMap g) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

Methods

fold :: Monoid m => LGridMap g m -> m #

foldMap :: Monoid m => (a -> m) -> LGridMap g a -> m #

foldr :: (a -> b -> b) -> b -> LGridMap g a -> b #

foldr' :: (a -> b -> b) -> b -> LGridMap g a -> b #

foldl :: (b -> a -> b) -> b -> LGridMap g a -> b #

foldl' :: (b -> a -> b) -> b -> LGridMap g a -> b #

foldr1 :: (a -> a -> a) -> LGridMap g a -> a #

foldl1 :: (a -> a -> a) -> LGridMap g a -> a #

toList :: LGridMap g a -> [a] #

null :: LGridMap g a -> Bool #

length :: LGridMap g a -> Int #

elem :: Eq a => a -> LGridMap g a -> Bool #

maximum :: Ord a => LGridMap g a -> a #

minimum :: Ord a => LGridMap g a -> a #

sum :: Num a => LGridMap g a -> a #

product :: Num a => LGridMap g a -> a #

Grid g => GridMap (LGridMap g) v Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

Associated Types

type BaseGrid (LGridMap g) v :: Type Source #

Methods

(!) :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => LGridMap g v -> k -> v Source #

toMap :: k ~ Index (BaseGrid (LGridMap g) v) => LGridMap g v -> Map k v Source #

toGrid :: LGridMap g v -> BaseGrid (LGridMap g) v Source #

toList :: k ~ Index (BaseGrid (LGridMap g) v) => LGridMap g v -> [(k, v)] Source #

lookup :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => k -> LGridMap g v -> Maybe v Source #

insert :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => k -> v -> LGridMap g v -> LGridMap g v Source #

insertWith :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => (v -> v -> v) -> k -> v -> LGridMap g v -> LGridMap g v Source #

insertWithKey :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => (k -> v -> v -> v) -> k -> v -> LGridMap g v -> LGridMap g v Source #

insertLookupWithKey :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => (k -> v -> v -> v) -> k -> v -> LGridMap g v -> (Maybe v, LGridMap g v) Source #

delete :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => k -> LGridMap g v -> LGridMap g v Source #

adjust :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => (v -> v) -> k -> LGridMap g v -> LGridMap g v Source #

adjustWithKey :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => (k -> v -> v) -> k -> LGridMap g v -> LGridMap g v Source #

alter :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => (Maybe v -> Maybe v) -> k -> LGridMap g v -> LGridMap g v Source #

findWithDefault :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => v -> k -> LGridMap g v -> v Source #

keys :: (k ~ Index (BaseGrid (LGridMap g) v), Ord k) => LGridMap g v -> [k] Source #

elems :: LGridMap g v -> [v] Source #

map :: (GridMap (LGridMap g) v2, Index (BaseGrid (LGridMap g) v) ~ Index (BaseGrid (LGridMap g) v2)) => (v -> v2) -> LGridMap g v -> LGridMap g v2 Source #

mapWithKey :: (k ~ Index (BaseGrid (LGridMap g) v), k ~ Index (BaseGrid (LGridMap g) v2), GridMap (LGridMap g) v2) => (k -> v -> v2) -> LGridMap g v -> LGridMap g v2 Source #

filter :: (v -> Bool) -> LGridMap g v -> LGridMap g v Source #

filterWithKey :: k ~ Index (BaseGrid (LGridMap g) v) => (k -> v -> Bool) -> LGridMap g v -> LGridMap g v Source #

(Eq g, Eq (Index g), Eq v) => Eq (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

Methods

(==) :: LGridMap g v -> LGridMap g v -> Bool #

(/=) :: LGridMap g v -> LGridMap g v -> Bool #

(Show g, Show v) => Show (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

Methods

showsPrec :: Int -> LGridMap g v -> ShowS #

show :: LGridMap g v -> String #

showList :: [LGridMap g v] -> ShowS #

Generic (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

Associated Types

type Rep (LGridMap g v) :: Type -> Type #

Methods

from :: LGridMap g v -> Rep (LGridMap g v) x #

to :: Rep (LGridMap g v) x -> LGridMap g v #

WrappedGrid g => WrappedGrid (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

Methods

normalise :: LGridMap g v -> Index (LGridMap g v) -> Index (LGridMap g v) Source #

denormalise :: LGridMap g v -> Index (LGridMap g v) -> [Index (LGridMap g v)] Source #

BoundedGrid g => BoundedGrid (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

FiniteGrid g => FiniteGrid (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

Associated Types

type Size (LGridMap g v) :: Type Source #

Grid g => Grid (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

Associated Types

type Index (LGridMap g v) :: Type Source #

type Direction (LGridMap g v) :: Type Source #

Methods

indices :: LGridMap g v -> [Index (LGridMap g v)] Source #

distance :: LGridMap g v -> Index (LGridMap g v) -> Index (LGridMap g v) -> Int Source #

minDistance :: LGridMap g v -> [Index (LGridMap g v)] -> Index (LGridMap g v) -> Int Source #

neighbours :: LGridMap g v -> Index (LGridMap g v) -> [Index (LGridMap g v)] Source #

neighboursOfSet :: LGridMap g v -> [Index (LGridMap g v)] -> [Index (LGridMap g v)] Source #

neighbour :: LGridMap g v -> Index (LGridMap g v) -> Direction (LGridMap g v) -> Maybe (Index (LGridMap g v)) Source #

numNeighbours :: LGridMap g v -> Index (LGridMap g v) -> Int Source #

contains :: LGridMap g v -> Index (LGridMap g v) -> Bool Source #

tileCount :: LGridMap g v -> Int Source #

null :: LGridMap g v -> Bool Source #

nonNull :: LGridMap g v -> Bool Source #

edges :: LGridMap g v -> [(Index (LGridMap g v), Index (LGridMap g v))] Source #

viewpoint :: LGridMap g v -> Index (LGridMap g v) -> [(Index (LGridMap g v), Int)] Source #

isAdjacent :: LGridMap g v -> Index (LGridMap g v) -> Index (LGridMap g v) -> Bool Source #

adjacentTilesToward :: LGridMap g v -> Index (LGridMap g v) -> Index (LGridMap g v) -> [Index (LGridMap g v)] Source #

minimalPaths :: LGridMap g v -> Index (LGridMap g v) -> Index (LGridMap g v) -> [[Index (LGridMap g v)]] Source #

directionTo :: LGridMap g v -> Index (LGridMap g v) -> Index (LGridMap g v) -> [Direction (LGridMap g v)] Source #

defaultMinDistance :: LGridMap g v -> [Index (LGridMap g v)] -> Index (LGridMap g v) -> Int Source #

defaultNeighbours :: LGridMap g v -> Index (LGridMap g v) -> [Index (LGridMap g v)] Source #

defaultNeighboursOfSet :: LGridMap g v -> [Index (LGridMap g v)] -> [Index (LGridMap g v)] Source #

defaultNeighbour :: LGridMap g v -> Index (LGridMap g v) -> Direction (LGridMap g v) -> Maybe (Index (LGridMap g v)) Source #

defaultTileCount :: LGridMap g v -> Int Source #

defaultEdges :: LGridMap g v -> [(Index (LGridMap g v), Index (LGridMap g v))] Source #

defaultIsAdjacent :: LGridMap g v -> Index (LGridMap g v) -> Index (LGridMap g v) -> Bool Source #

defaultAdjacentTilesToward :: LGridMap g v -> Index (LGridMap g v) -> Index (LGridMap g v) -> [Index (LGridMap g v)] Source #

defaultMinimalPaths :: LGridMap g v -> Index (LGridMap g v) -> Index (LGridMap g v) -> [[Index (LGridMap g v)]] Source #

type BaseGrid (LGridMap g) v Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

type BaseGrid (LGridMap g) v = g
type Rep (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

type Rep (LGridMap g v) = D1 (MetaData "LGridMap" "Math.Geometry.GridMap.Lazy" "grid-7.8.12-1ADrZUlWO0vHdPyzqP6MYM" False) (C1 (MetaCons "LGridMap" PrefixI True) (S1 (MetaSel (Just "lgmGrid") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 g) :*: S1 (MetaSel (Just "lgmMap") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map (Index g) v))))
type Size (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

type Size (LGridMap g v) = Size g
type Index (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

type Index (LGridMap g v) = Index g
type Direction (LGridMap g v) Source # 
Instance details

Defined in Math.Geometry.GridMap.Lazy

lazyGridMap :: (Ord (Index g), Grid g) => g -> [v] -> LGridMap g v Source #

Construct a grid map which is strict in the keys (tile positions), but lazy in the values.

lazyGridMapIndexed :: (Ord (Index g), Grid g) => g -> [(Index g, v)] -> LGridMap g v Source #

empty :: g -> LGridMap g v Source #