Safe Haskell | None |
---|---|
Language | Haskell2010 |
Arrays, based on Data.Vector.Unboxed, indexed by Point
.
Synopsis
- class (Ord c, Eq (UnboxRep c), Ord (UnboxRep c), Bounded (UnboxRep c), Binary (UnboxRep c), Unbox (UnboxRep c)) => UnboxRepClass c where
- type UnboxRep c
- data Array c = Array {}
- pindex :: X -> Point -> Int
- punindex :: X -> Int -> Point
- (!) :: UnboxRepClass c => Array c -> Point -> c
- accessI :: UnboxRepClass c => Array c -> Int -> UnboxRep c
- (//) :: UnboxRepClass c => Array c -> [(Point, c)] -> Array c
- unsafeUpdateA :: UnboxRepClass c => Array c -> [(Point, c)] -> ()
- unsafeWriteA :: UnboxRepClass c => Array c -> Point -> c -> ()
- unsafeWriteManyA :: UnboxRepClass c => Array c -> [Point] -> c -> ()
- replicateA :: UnboxRepClass c => X -> Y -> c -> Array c
- replicateMA :: (Monad m, UnboxRepClass c) => X -> Y -> m c -> m (Array c)
- generateA :: UnboxRepClass c => X -> Y -> (Point -> c) -> Array c
- generateMA :: (Monad m, UnboxRepClass c) => X -> Y -> (Point -> m c) -> m (Array c)
- unfoldrNA :: UnboxRepClass c => X -> Y -> (b -> (c, b)) -> b -> Array c
- sizeA :: Array c -> (X, Y)
- foldrA :: UnboxRepClass c => (c -> a -> a) -> a -> Array c -> a
- foldrA' :: UnboxRepClass c => (c -> a -> a) -> a -> Array c -> a
- foldlA' :: UnboxRepClass c => (a -> c -> a) -> a -> Array c -> a
- ifoldrA :: UnboxRepClass c => (Point -> c -> a -> a) -> a -> Array c -> a
- ifoldrA' :: UnboxRepClass c => (Point -> c -> a -> a) -> a -> Array c -> a
- ifoldlA' :: UnboxRepClass c => (a -> Point -> c -> a) -> a -> Array c -> a
- foldMA' :: (Monad m, UnboxRepClass c) => (a -> c -> m a) -> a -> Array c -> m a
- ifoldMA' :: (Monad m, UnboxRepClass c) => (a -> Point -> c -> m a) -> a -> Array c -> m a
- mapA :: (UnboxRepClass c, UnboxRepClass d) => (c -> d) -> Array c -> Array d
- imapA :: (UnboxRepClass c, UnboxRepClass d) => (Point -> c -> d) -> Array c -> Array d
- imapMA_ :: (Monad m, UnboxRepClass c) => (Point -> c -> m ()) -> Array c -> m ()
- safeSetA :: UnboxRepClass c => c -> Array c -> Array c
- unsafeSetA :: UnboxRepClass c => c -> Array c -> Array c
- minIndexA :: UnboxRepClass c => Array c -> Point
- minLastIndexA :: UnboxRepClass c => Array c -> Point
- minIndexesA :: UnboxRepClass c => Array c -> [Point]
- maxIndexA :: UnboxRepClass c => Array c -> Point
- maxLastIndexA :: UnboxRepClass c => Array c -> Point
- forceA :: UnboxRepClass c => Array c -> Array c
- fromListA :: UnboxRepClass c => X -> Y -> [c] -> Array c
- toListA :: UnboxRepClass c => Array c -> [c]
- toUnboxRep :: UnboxRepClass c => c -> UnboxRep c
Documentation
class (Ord c, Eq (UnboxRep c), Ord (UnboxRep c), Bounded (UnboxRep c), Binary (UnboxRep c), Unbox (UnboxRep c)) => UnboxRepClass c where Source #
toUnboxRepUnsafe :: c -> UnboxRep c Source #
fromUnboxRep :: UnboxRep c -> c Source #
Instances
UnboxRepClass Bool Source # | |
UnboxRepClass Word8 Source # | |
UnboxRepClass AttrCharW32 Source # | |
Defined in Game.LambdaHack.Common.Color type UnboxRep AttrCharW32 :: * Source # | |
UnboxRepClass BfsDistance Source # | |
Defined in Game.LambdaHack.Client.Bfs type UnboxRep BfsDistance :: * Source # | |
UnboxRepClass (ContentId k) Source # | |
Arrays indexed by Point
.
(//) :: UnboxRepClass c => Array c -> [(Point, c)] -> Array c Source #
Construct an array updated with the association list.
unsafeUpdateA :: UnboxRepClass c => Array c -> [(Point, c)] -> () Source #
unsafeWriteA :: UnboxRepClass c => Array c -> Point -> c -> () Source #
unsafeWriteManyA :: UnboxRepClass c => Array c -> [Point] -> c -> () Source #
replicateA :: UnboxRepClass c => X -> Y -> c -> Array c Source #
Create an array from a replicated element.
replicateMA :: (Monad m, UnboxRepClass c) => X -> Y -> m c -> m (Array c) Source #
Create an array from a replicated monadic action.
generateA :: UnboxRepClass c => X -> Y -> (Point -> c) -> Array c Source #
Create an array from a function.
generateMA :: (Monad m, UnboxRepClass c) => X -> Y -> (Point -> m c) -> m (Array c) Source #
Create an array from a monadic function.
foldrA :: UnboxRepClass c => (c -> a -> a) -> a -> Array c -> a Source #
Fold right over an array.
foldrA' :: UnboxRepClass c => (c -> a -> a) -> a -> Array c -> a Source #
Fold right strictly over an array.
foldlA' :: UnboxRepClass c => (a -> c -> a) -> a -> Array c -> a Source #
Fold left strictly over an array.
ifoldrA :: UnboxRepClass c => (Point -> c -> a -> a) -> a -> Array c -> a Source #
Fold right over an array (function applied to each element and its index).
ifoldrA' :: UnboxRepClass c => (Point -> c -> a -> a) -> a -> Array c -> a Source #
Fold right strictly over an array (function applied to each element and its index).
ifoldlA' :: UnboxRepClass c => (a -> Point -> c -> a) -> a -> Array c -> a Source #
Fold left strictly over an array (function applied to each element and its index).
foldMA' :: (Monad m, UnboxRepClass c) => (a -> c -> m a) -> a -> Array c -> m a Source #
Fold monadically strictly over an array.
ifoldMA' :: (Monad m, UnboxRepClass c) => (a -> Point -> c -> m a) -> a -> Array c -> m a Source #
Fold monadically strictly over an array (function applied to each element and its index).
mapA :: (UnboxRepClass c, UnboxRepClass d) => (c -> d) -> Array c -> Array d Source #
Map over an array.
imapA :: (UnboxRepClass c, UnboxRepClass d) => (Point -> c -> d) -> Array c -> Array d Source #
Map over an array (function applied to each element and its index).
imapMA_ :: (Monad m, UnboxRepClass c) => (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 :: UnboxRepClass c => c -> Array c -> Array c Source #
Set all elements to the given value, in place, if possible.
unsafeSetA :: UnboxRepClass c => c -> Array c -> Array c Source #
Set all elements to the given value, in place.
minIndexA :: UnboxRepClass c => Array c -> Point Source #
Yield the point coordinates of a minimum element of the array. The array may not be empty.
minLastIndexA :: UnboxRepClass c => Array c -> Point Source #
Yield the point coordinates of the last minimum element of the array. The array may not be empty.
minIndexesA :: UnboxRepClass c => Array c -> [Point] Source #
Yield the point coordinates of all the minimum elements of the array. The array may not be empty.
maxIndexA :: UnboxRepClass c => Array c -> Point Source #
Yield the point coordinates of the first maximum element of the array. The array may not be empty.
maxLastIndexA :: UnboxRepClass c => Array c -> Point Source #
Yield the point coordinates of the last maximum element of the array. The array may not be empty.
forceA :: UnboxRepClass c => Array c -> Array c Source #
Force the array not to retain any extra memory.
toListA :: UnboxRepClass c => Array c -> [c] Source #
Internal operations
toUnboxRep :: UnboxRepClass c => c -> UnboxRep c Source #