LambdaHack-0.5.0.0: A game engine library for roguelike dungeon crawlers

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Common.PointArray

Description

Arrays, based on Data.Vector.Unboxed, indexed by Point.

Synopsis

Documentation

data Array c Source

Arrays indexed by Point.

Instances

Eq (Array c) 
Show (Array c) 
Binary (Array c) 

(!) :: Enum c => Array c -> Point -> c Source

Array lookup.

(//) :: Enum c => Array c -> [(Point, c)] -> Array c Source

Construct an array updated with the association list.

replicateA :: Enum c => X -> Y -> c -> Array c Source

Create an array from a replicated element.

replicateMA :: Enum c => Monad m => X -> Y -> m c -> m (Array c) Source

Create an array from a replicated monadic action.

generateA :: Enum c => X -> Y -> (Point -> c) -> Array c Source

Create an array from a function.

generateMA :: Enum c => Monad m => X -> Y -> (Point -> m c) -> m (Array c) Source

Create an array from a monadic function.

sizeA :: Array c -> (X, Y) Source

Content identifiers array size.

foldlA :: Enum c => (a -> c -> a) -> a -> Array c -> a Source

Fold left strictly over an array.

ifoldlA :: Enum c => (a -> Point -> c -> a) -> a -> Array c -> a Source

Fold left strictly over an array (function applied to each element and its index).

mapA :: (Enum c, Enum d) => (c -> d) -> Array c -> Array d Source

Map over an array.

imapA :: (Enum c, Enum d) => (Point -> c -> d) -> Array c -> Array d Source

Map over an array (function applied to each element and its index).

mapWithKeyMA :: Enum c => Monad m => (Point -> c -> m ()) -> Array c -> m () Source

Map monadically over an array (function applied to each element and its index) and ignore the results.

safeSetA :: Enum c => c -> Array c -> Array c Source

Set all elements to the given value, in place, if possible.

unsafeSetA :: Enum c => c -> Array c -> Array c Source

Set all elements to the given value, in place.

unsafeUpdateA :: Enum c => Array c -> [(Point, c)] -> Array c Source

minIndexA :: Enum c => Array c -> Point Source

Yield the point coordinates of a minimum element of the array. The array may not be empty.

minLastIndexA :: Enum c => Array c -> Point Source

Yield the point coordinates of the last minimum element of the array. The array may not be empty.

minIndexesA :: Enum c => Array c -> [Point] Source

Yield the point coordinates of all the minimum elements of the array. The array may not be empty.

maxIndexA :: Enum c => Array c -> Point Source

Yield the point coordinates of the first maximum element of the array. The array may not be empty.

maxLastIndexA :: Enum c => Array c -> Point Source

Yield the point coordinates of the last maximum element of the array. The array may not be empty.

forceA :: Enum c => Array c -> Array c Source

Force the array not to retain any extra memory.