| Copyright | (c) Matt Hunzinger 2025 |
|---|---|
| License | BSD-style (see the LICENSE file in the distribution) |
| Maintainer | matt@hunzinger.me |
| Stability | provisional |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
Aztecs.Hierarchy
Description
Synopsis
- newtype Parent = Parent {}
- newtype Children = Children {}
- update :: forall (m :: Type -> Type). Monad m => Access m ()
- data Hierarchy a = Node {
- nodeEntityId :: EntityID
- nodeEntity :: a
- nodeChildren :: [Hierarchy a]
- toList :: Hierarchy a -> Vector (EntityID, a)
- foldWithKey :: (EntityID -> a -> b -> b) -> Hierarchy a -> b -> b
- mapWithKey :: (EntityID -> a -> b) -> Hierarchy a -> Hierarchy b
- mapWithAccum :: (EntityID -> a -> b -> (c, b)) -> b -> Hierarchy a -> Hierarchy c
- hierarchy :: forall (m :: Type -> Type) a. Monad m => EntityID -> Query m a -> Access m (Maybe (Hierarchy a))
- hierarchies :: forall (m :: Type -> Type) a. Monad m => Query m a -> Access m (Vector (Hierarchy a))
- newtype ParentState = ParentState {}
- newtype ChildState = ChildState {}
Documentation
Parent component.
Instances
| Generic Parent Source # | |||||
Defined in Aztecs.Hierarchy Associated Types
| |||||
| Show Parent Source # | |||||
| Eq Parent Source # | |||||
| Ord Parent Source # | |||||
| Monad m => Component m Parent Source # | |||||
Defined in Aztecs.Hierarchy Associated Types
| |||||
| type StorageT Parent Source # | |||||
Defined in Aztecs.Hierarchy | |||||
| type Rep Parent Source # | |||||
Defined in Aztecs.Hierarchy | |||||
Children component.
Constructors
| Children | |
Fields | |
Instances
| Monoid Children Source # | |||||
| Semigroup Children Source # | |||||
| Generic Children Source # | |||||
Defined in Aztecs.Hierarchy Associated Types
| |||||
| Show Children Source # | |||||
| Eq Children Source # | |||||
| Ord Children Source # | |||||
Defined in Aztecs.Hierarchy | |||||
| Monad m => Component m Children Source # | |||||
Defined in Aztecs.Hierarchy Associated Types
| |||||
| type StorageT Children Source # | |||||
Defined in Aztecs.Hierarchy | |||||
| type Rep Children Source # | |||||
Defined in Aztecs.Hierarchy | |||||
update :: forall (m :: Type -> Type). Monad m => Access m () Source #
Update the parent-child relationships.
Hierarchy of entities.
Constructors
| Node | |
Fields
| |
Instances
| Foldable Hierarchy Source # | |
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] # length :: Hierarchy a -> Int # elem :: Eq a => a -> Hierarchy a -> Bool # maximum :: Ord a => Hierarchy a -> a # minimum :: Ord a => Hierarchy a -> a # | |
| Traversable Hierarchy Source # | |
Defined in Aztecs.Hierarchy | |
| Functor Hierarchy Source # | |
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 | |
Fields | |
Instances
newtype ChildState Source #
Child internal state component.
Constructors
| ChildState | |
Fields | |
Instances
| Generic ChildState Source # | |||||
Defined in Aztecs.Hierarchy Associated Types
| |||||
| Show ChildState Source # | |||||
Defined in Aztecs.Hierarchy Methods showsPrec :: Int -> ChildState -> ShowS # show :: ChildState -> String # showList :: [ChildState] -> ShowS # | |||||
| Monad m => Component m ChildState Source # | |||||
Defined in Aztecs.Hierarchy Associated Types
Methods componentOnInsert :: EntityID -> ChildState -> Access m () Source # componentOnChange :: EntityID -> ChildState -> Access m () Source # componentOnRemove :: EntityID -> ChildState -> Access m () Source # | |||||
| type StorageT ChildState Source # | |||||
Defined in Aztecs.Hierarchy | |||||
| type Rep ChildState Source # | |||||
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)))) | |||||