LambdaHack- A roguelike game engine in early and active development

Safe HaskellNone




General content types and operations.


General content types

data Id c Source

Content identifiers for the content type c.


Enum (Id c) 
Eq (Id c) 
Ord (Id c) 
Show (Id c) 
Ix (Id c) 
Binary (Id c) 

data family Speedup a Source

Type family for auxiliary data structures for speeding up content operations.

data Ops a Source

Content operations for the content of type a.




okind :: Id a -> a

the content element at given id

ouniqGroup :: Text -> Id a

the id of the unique member of a singleton content group

opick :: Text -> (a -> Bool) -> Rnd (Maybe (Id a))

pick a random id belonging to a group and satisfying a predicate

ofoldrWithKey :: forall b. (Id a -> a -> b -> b) -> b -> b

fold over all content elements of a

obounds :: !(Id a, Id a)

bounds of identifiers of content a

ospeedup :: !(Maybe (Speedup a))

auxiliary speedup components

data COps Source

Operations for all content types, gathered together.




createOps :: forall a. Show a => ContentDef a -> Ops aSource

Create content operations for type a from definition of content of type a.

stdRuleset :: Ops RuleKind -> RuleKindSource

The standard ruleset used for level operations.

Arrays of content identifiers

data Array i c Source

Arrays of content identifiers pointing to the content type c, where the identifiers are represented as Word8 (and so content of type c can have at most 256 elements). The arrays are indexed by type i, e.g., a dungeon tile position.


Ix i => Eq (Array i c) 
(Ix i, Show i) => Show (Array i c) 
(Ix i, Binary i) => Binary (Array i c) 

(!) :: Ix i => Array i c -> i -> Id cSource

Content identifiers array lookup.

(//) :: Ix i => Array i c -> [(i, Id c)] -> Array i cSource

Construct a content identifiers array updated with the association list.

listArray :: Ix i => (i, i) -> [Id c] -> Array i cSource

Create a content identifiers array from a list of elements.

array :: Ix i => (i, i) -> [(i, Id c)] -> Array i cSource

Create a content identifiers array from an association list.

bounds :: Ix i => Array i c -> (i, i)Source

Content identifiers array bounds.

foldlArray :: Ix i => (a -> Id c -> a) -> a -> Array i c -> aSource

Fold left strictly over an array.