aztecs-0.16.0: A modular game engine and Entity-Component-System (ECS) for Haskell.
Copyright(c) Matt Hunzinger 2025
LicenseBSD-style (see the LICENSE file in the distribution)
Maintainermatt@hunzinger.me
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Aztecs.Hierarchy

Description

Hierarchical relationships. A Children component forms a one-to-many relationship with Parent components.

Synopsis

Documentation

newtype Parent Source #

Parent component.

Constructors

Parent 

Fields

Instances

Instances details
Generic Parent Source # 
Instance details

Defined in Aztecs.Hierarchy

Associated Types

type Rep Parent 
Instance details

Defined in Aztecs.Hierarchy

type Rep Parent = D1 ('MetaData "Parent" "Aztecs.Hierarchy" "aztecs-0.16.0-1t3LRuVnzUqKpg58E4sSVq" 'True) (C1 ('MetaCons "Parent" 'PrefixI 'True) (S1 ('MetaSel ('Just "unParent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EntityID)))

Methods

from :: Parent -> Rep Parent x #

to :: Rep Parent x -> Parent #

Show Parent Source # 
Instance details

Defined in Aztecs.Hierarchy

Eq Parent Source # 
Instance details

Defined in Aztecs.Hierarchy

Methods

(==) :: Parent -> Parent -> Bool #

(/=) :: Parent -> Parent -> Bool #

Ord Parent Source # 
Instance details

Defined in Aztecs.Hierarchy

Monad m => Component m Parent Source # 
Instance details

Defined in Aztecs.Hierarchy

Associated Types

type StorageT Parent 
Instance details

Defined in Aztecs.Hierarchy

type StorageT Parent = Vector Parent
type StorageT Parent Source # 
Instance details

Defined in Aztecs.Hierarchy

type StorageT Parent = Vector Parent
type Rep Parent Source # 
Instance details

Defined in Aztecs.Hierarchy

type Rep Parent = D1 ('MetaData "Parent" "Aztecs.Hierarchy" "aztecs-0.16.0-1t3LRuVnzUqKpg58E4sSVq" 'True) (C1 ('MetaCons "Parent" 'PrefixI 'True) (S1 ('MetaSel ('Just "unParent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EntityID)))

newtype Children Source #

Children component.

Constructors

Children 

Instances

Instances details
Monoid Children Source # 
Instance details

Defined in Aztecs.Hierarchy

Semigroup Children Source # 
Instance details

Defined in Aztecs.Hierarchy

Generic Children Source # 
Instance details

Defined in Aztecs.Hierarchy

Associated Types

type Rep Children 
Instance details

Defined in Aztecs.Hierarchy

type Rep Children = D1 ('MetaData "Children" "Aztecs.Hierarchy" "aztecs-0.16.0-1t3LRuVnzUqKpg58E4sSVq" 'True) (C1 ('MetaCons "Children" 'PrefixI 'True) (S1 ('MetaSel ('Just "unChildren") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set EntityID))))

Methods

from :: Children -> Rep Children x #

to :: Rep Children x -> Children #

Show Children Source # 
Instance details

Defined in Aztecs.Hierarchy

Eq Children Source # 
Instance details

Defined in Aztecs.Hierarchy

Ord Children Source # 
Instance details

Defined in Aztecs.Hierarchy

Monad m => Component m Children Source # 
Instance details

Defined in Aztecs.Hierarchy

Associated Types

type StorageT Children 
Instance details

Defined in Aztecs.Hierarchy

type StorageT Children = Vector Children
type StorageT Children Source # 
Instance details

Defined in Aztecs.Hierarchy

type StorageT Children = Vector Children
type Rep Children Source # 
Instance details

Defined in Aztecs.Hierarchy

type Rep Children = D1 ('MetaData "Children" "Aztecs.Hierarchy" "aztecs-0.16.0-1t3LRuVnzUqKpg58E4sSVq" 'True) (C1 ('MetaCons "Children" 'PrefixI 'True) (S1 ('MetaSel ('Just "unChildren") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set EntityID))))

update :: forall (m :: Type -> Type). Monad m => Access m () Source #

Update the parent-child relationships.

data Hierarchy a Source #

Hierarchy of entities.

Constructors

Node 

Fields

Instances

Instances details
Foldable Hierarchy Source # 
Instance details

Defined in Aztecs.Hierarchy

Methods

fold :: Monoid m => Hierarchy m -> m #

foldMap :: Monoid m => (a -> m) -> Hierarchy a -> m #

foldMap' :: Monoid m => (a -> m) -> Hierarchy a -> m #

foldr :: (a -> b -> b) -> b -> Hierarchy a -> b #

foldr' :: (a -> b -> b) -> b -> Hierarchy a -> b #

foldl :: (b -> a -> b) -> b -> Hierarchy a -> b #

foldl' :: (b -> a -> b) -> b -> Hierarchy a -> b #

foldr1 :: (a -> a -> a) -> Hierarchy a -> a #

foldl1 :: (a -> a -> a) -> Hierarchy a -> a #

toList :: Hierarchy a -> [a] #

null :: Hierarchy a -> Bool #

length :: Hierarchy a -> Int #

elem :: Eq a => a -> Hierarchy a -> Bool #

maximum :: Ord a => Hierarchy a -> a #

minimum :: Ord a => Hierarchy a -> a #

sum :: Num a => Hierarchy a -> a #

product :: Num a => Hierarchy a -> a #

Traversable Hierarchy Source # 
Instance details

Defined in Aztecs.Hierarchy

Methods

traverse :: Applicative f => (a -> f b) -> Hierarchy a -> f (Hierarchy b) #

sequenceA :: Applicative f => Hierarchy (f a) -> f (Hierarchy a) #

mapM :: Monad m => (a -> m b) -> Hierarchy a -> m (Hierarchy b) #

sequence :: Monad m => Hierarchy (m a) -> m (Hierarchy a) #

Functor Hierarchy Source # 
Instance details

Defined in Aztecs.Hierarchy

Methods

fmap :: (a -> b) -> Hierarchy a -> Hierarchy b #

(<$) :: a -> Hierarchy b -> Hierarchy a #

toList :: Hierarchy a -> Vector (EntityID, a) Source #

Convert a hierarchy to a vector of entity IDs and components.

foldWithKey :: (EntityID -> a -> b -> b) -> Hierarchy a -> b -> b Source #

Fold a hierarchy with a function that takes the entity ID, entity, and accumulator.

mapWithKey :: (EntityID -> a -> b) -> Hierarchy a -> Hierarchy b Source #

Map a hierarchy with a function that takes the entity ID and entity.

mapWithAccum :: (EntityID -> a -> b -> (c, b)) -> b -> Hierarchy a -> Hierarchy c Source #

Map a hierarchy with a function that takes the entity ID, entity, and accumulator.

hierarchy :: forall (m :: Type -> Type) a. Monad m => EntityID -> Query m a -> Access m (Maybe (Hierarchy a)) Source #

System to read a hierarchy of parents to children with the given query.

hierarchies :: forall (m :: Type -> Type) a. Monad m => Query m a -> Access m (Vector (Hierarchy a)) Source #

Build all hierarchies of parents to children, joined with the given query.

newtype ParentState Source #

Parent internal state component.

Constructors

ParentState 

Instances

Instances details
Generic ParentState Source # 
Instance details

Defined in Aztecs.Hierarchy

Associated Types

type Rep ParentState 
Instance details

Defined in Aztecs.Hierarchy

type Rep ParentState = D1 ('MetaData "ParentState" "Aztecs.Hierarchy" "aztecs-0.16.0-1t3LRuVnzUqKpg58E4sSVq" 'True) (C1 ('MetaCons "ParentState" 'PrefixI 'True) (S1 ('MetaSel ('Just "unParentState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EntityID)))
Show ParentState Source # 
Instance details

Defined in Aztecs.Hierarchy

Monad m => Component m ParentState Source # 
Instance details

Defined in Aztecs.Hierarchy

Associated Types

type StorageT ParentState 
Instance details

Defined in Aztecs.Hierarchy

type StorageT ParentState Source # 
Instance details

Defined in Aztecs.Hierarchy

type Rep ParentState Source # 
Instance details

Defined in Aztecs.Hierarchy

type Rep ParentState = D1 ('MetaData "ParentState" "Aztecs.Hierarchy" "aztecs-0.16.0-1t3LRuVnzUqKpg58E4sSVq" 'True) (C1 ('MetaCons "ParentState" 'PrefixI 'True) (S1 ('MetaSel ('Just "unParentState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EntityID)))

newtype ChildState Source #

Child internal state component.

Constructors

ChildState 

Instances

Instances details
Generic ChildState Source # 
Instance details

Defined in Aztecs.Hierarchy

Associated Types

type Rep ChildState 
Instance details

Defined in Aztecs.Hierarchy

type Rep ChildState = D1 ('MetaData "ChildState" "Aztecs.Hierarchy" "aztecs-0.16.0-1t3LRuVnzUqKpg58E4sSVq" 'True) (C1 ('MetaCons "ChildState" 'PrefixI 'True) (S1 ('MetaSel ('Just "unChildState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set EntityID))))
Show ChildState Source # 
Instance details

Defined in Aztecs.Hierarchy

Monad m => Component m ChildState Source # 
Instance details

Defined in Aztecs.Hierarchy

Associated Types

type StorageT ChildState 
Instance details

Defined in Aztecs.Hierarchy

type StorageT ChildState Source # 
Instance details

Defined in Aztecs.Hierarchy

type Rep ChildState Source # 
Instance details

Defined in Aztecs.Hierarchy

type Rep ChildState = D1 ('MetaData "ChildState" "Aztecs.Hierarchy" "aztecs-0.16.0-1t3LRuVnzUqKpg58E4sSVq" 'True) (C1 ('MetaCons "ChildState" 'PrefixI 'True) (S1 ('MetaSel ('Just "unChildState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set EntityID))))