LambdaHack-0.11.0.1: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Common.PointArray

Contents

- Internal operations

Description

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
  - toUnboxRepUnsafe :: c -> UnboxRep c
  - fromUnboxRep :: UnboxRep c -> c
- data Array c = Array {
  - axsize :: X
  - aysize :: Y
  - avector :: Vector (UnboxRep c)
  }
- empty :: UnboxRepClass c => Array c
- (!) :: UnboxRepClass c => Array c -> Point -> c
- accessI :: UnboxRepClass c => Array c -> Int -> UnboxRep c
- (//) :: UnboxRepClass c => Array c -> [(Point, c)] -> Array c
- replicateA :: UnboxRepClass c => X -> Y -> c -> Array c
- unfoldrNA :: UnboxRepClass c => X -> Y -> (b -> (c, b)) -> b -> Array c
- 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
- ifoldlA' :: UnboxRepClass c => (a -> Point -> c -> a) -> a -> Array c -> a
- ifoldrA' :: UnboxRepClass c => (Point -> c -> a -> a) -> a -> Array c -> a
- foldMA' :: (Monad m, UnboxRepClass c) => (a -> 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 ()
- minIndexesA :: UnboxRepClass c => Array c -> [Point]
- maxIndexA :: UnboxRepClass c => Array c -> Point
- maxIndexByA :: UnboxRepClass c => (c -> c -> Ordering) -> Array c -> Point
- maxLastIndexA :: UnboxRepClass c => Array c -> Point
- 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 #

Associated Types

type UnboxRep c Source #

type UnboxRep c = c

Methods

toUnboxRepUnsafe :: c -> UnboxRep c Source #

fromUnboxRep :: UnboxRep c -> c Source #

#### Instances

Instances details

UnboxRepClass BfsDistance Source # |

Instance details

Defined in Game.LambdaHack.Client.Bfs

Associated Types

type UnboxRep BfsDistance |
Instance details Defined in Game.LambdaHack.Client.Bfs type UnboxRep BfsDistance

Methods

toUnboxRepUnsafe :: BfsDistance -> UnboxRep BfsDistance Source #

fromUnboxRep :: UnboxRep BfsDistance -> BfsDistance Source #

UnboxRepClass AttrCharW32 Source # |

Instance details

Defined in Game.LambdaHack.Common.PointArray

Associated Types

type UnboxRep AttrCharW32 |
Instance details Defined in Game.LambdaHack.Common.PointArray type UnboxRep AttrCharW32 = Word32

Methods

toUnboxRepUnsafe :: AttrCharW32 -> UnboxRep AttrCharW32 Source #

fromUnboxRep :: UnboxRep AttrCharW32 -> AttrCharW32 Source #

UnboxRepClass Word8 Source # |

Instance details

Defined in Game.LambdaHack.Common.PointArray

Associated Types

type UnboxRep Word8 |
Instance details Defined in Game.LambdaHack.Common.PointArray type UnboxRep Word8 = Word8

Methods

toUnboxRepUnsafe :: Word8 -> UnboxRep Word8 Source #

fromUnboxRep :: UnboxRep Word8 -> Word8 Source #

UnboxRepClass Bool Source # |

Instance details

Defined in Game.LambdaHack.Common.PointArray

Associated Types

type UnboxRep Bool |
Instance details Defined in Game.LambdaHack.Common.PointArray type UnboxRep Bool = Bool

Methods

toUnboxRepUnsafe :: Bool -> UnboxRep Bool Source #

fromUnboxRep :: UnboxRep Bool -> Bool Source #

UnboxRepClass (ContentId k) Source # |

Instance details

Defined in Game.LambdaHack.Common.PointArray

Associated Types

type UnboxRep (ContentId k) |
Instance details Defined in Game.LambdaHack.Common.PointArray type UnboxRep (ContentId k) = Word16

Methods

toUnboxRepUnsafe :: ContentId k -> UnboxRep (ContentId k) Source #

fromUnboxRep :: UnboxRep (ContentId k) -> ContentId k Source #

data Array c Source #

Arrays indexed by `Point`.

Constructors

Array |

Fields

- axsize :: X
- aysize :: Y
- avector :: Vector (UnboxRep c)

#### Instances

Instances details

UnboxRepClass c => Binary (Array c) Source # |
Instance details Defined in Game.LambdaHack.Common.PointArray Methods put :: Array c -> Put Source # get :: Get (Array c) Source # putList :: [Array c] -> Put Source #
Show (Array c) Source # |
Instance details Defined in Game.LambdaHack.Common.PointArray Methods showsPrec :: Int -> Array c -> ShowS Source # show :: Array c -> String Source # showList :: [Array c] -> ShowS Source #
UnboxRepClass c => Eq (Array c) Source # |
Instance details Defined in Game.LambdaHack.Common.PointArray Methods (==) :: Array c -> Array c -> Bool Source # (/=) :: Array c -> Array c -> Bool Source #

empty :: UnboxRepClass c => Array c Source #

(!) :: UnboxRepClass c => Array c -> Point -> c Source #

Array lookup.

accessI :: UnboxRepClass c => Array c -> Int -> UnboxRep c Source #

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

Construct an array updated with the association list.

replicateA :: UnboxRepClass c => X -> Y -> c -> Array c Source #

Create an array from a replicated element.

unfoldrNA :: UnboxRepClass c => X -> Y -> (b -> (c, b)) -> b -> Array c Source #

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.

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).

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).

foldMA' :: (Monad m, UnboxRepClass c) => (a -> c -> m a) -> a -> Array c -> m a Source #

Fold monadically strictly over an array.

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.

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.

maxIndexByA :: UnboxRepClass c => (c -> c -> Ordering) -> 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.

toListA :: UnboxRepClass c => Array c -> [c] Source #

# Internal operations

toUnboxRep :: UnboxRepClass c => c -> UnboxRep c Source #