discrete-space-map-0.0.3: A discrete space map.

Data.DiscreteSpaceMap

Synopsis

# Documentation

class Eq p => Pos p whereSource

To be a key in the map, a position needs to be convertible to and from a stream of bits.

Methods

uncons :: p -> (p, Bool)Source

cons :: (p, Bool) -> pSource

cons . uncons == id

zero :: pSource

uncons zero == (zero, False)

Instances

 Pos Integer 1D discrete space Pos [Bool] [Bool] is the free instance of Pos. Pos p => Pos (p, p) 2D discrete space Pos p => Pos (p, p, p) 3D discrete space

data Map p a Source

Map is a zipper on an infinite perfect binary tree. It contains the position and value of the focus. The other values are stored in the derivative of a perfect binary tree.

Functions that combine 2 maps like zipWith, zipWithKey and <@> preserve the focus position of the second argument.

Constructors

 Map !p !a (MapD a)

Instances

 Pos p => ComonadStore p (Map p) pos :: Pos p => Map p a -> p peek :: Pos p => p -> Map p a -> a seek :: Pos p => p -> Map p a -> Map p a seeks :: Pos p => (p -> p) -> Map p a -> Map p a Functor (Map p) fmap :: (a -> b) -> Map p a -> Map p b Foldable (Map p) foldMap :: Monoid m => (a -> m) -> Map p a -> m Traversable (Map p) traverse :: Applicative f => (a -> f b) -> Map p a -> f (Map p b) Pos p => Distributive (Map p) distribute :: Functor f => f (Map p a) -> Map p (f a) Pos p => Representable (Map p) index :: Pos p => Map p a -> p -> a tabulate :: Pos p => (p -> a) -> Map p a Comonad (Map p) extract :: Map p a -> a extend :: (Map p a -> b) -> Map p a -> Map p b Pos p => ComonadApply (Map p) (<@>) :: Pos p => Map p (a -> b) -> Map p a -> Map p b Pos p => Keyed (Map p) mapWithKey :: Pos p => (p -> a -> b) -> Map p a -> Map p b Pos p => Zip (Map p) zipWith :: Pos p => (a -> b -> c) -> Map p a -> Map p b -> Map p c Pos p => ZipWithKey (Map p) zipWithKey :: Pos p => (p -> a -> b -> c) -> Map p a -> Map p b -> Map p c Pos p => Indexable (Map p) Pos p => Lookup (Map p) Pos p => Adjustable (Map p) Pos p => FoldableWithKey (Map p) foldMapWithKey :: (Pos p, Monoid m) => (p -> a -> m) -> Map p a -> m Pos p => FoldableWithKey1 (Map p) Pos p => TraversableWithKey (Map p) traverseWithKey :: (Pos p, Applicative f) => (p -> a -> f b) -> Map p a -> f (Map p b) Pos p => TraversableWithKey1 (Map p) Traversable1 (Map p) Foldable1 (Map p) (Show p, Show a) => Show (Map p a)

modify :: (a -> a) -> Map p a -> Map p aSource

Modify the value of the focus.