aztecs-0.12.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 HaskellSafe-Inferred
LanguageHaskell2010

Aztecs.ECS.Query.Dynamic

Description

 
Synopsis

Dynamic queries

data DynamicQueryT f a where Source #

Dynamic query for components by ID.

Since: 0.11

Constructors

Entity :: DynamicQueryT f EntityID 
Pure :: a -> DynamicQueryT f a 
Map :: (a -> b) -> DynamicQueryT f a -> DynamicQueryT f b 
Ap :: DynamicQueryT f (a -> b) -> DynamicQueryT f a -> DynamicQueryT f b 
Lift :: (MonadTrans g, Monad (g f), Monad f) => DynamicQueryT f a -> DynamicQueryT (g f) a 
Op :: ComponentID -> Operation f a -> DynamicQueryT f a 

Instances

Instances details
Applicative (DynamicQueryT f) Source #

Since: 0.11

Instance details

Defined in Aztecs.ECS.Query.Dynamic

Methods

pure :: a -> DynamicQueryT f a #

(<*>) :: DynamicQueryT f (a -> b) -> DynamicQueryT f a -> DynamicQueryT f b #

liftA2 :: (a -> b -> c) -> DynamicQueryT f a -> DynamicQueryT f b -> DynamicQueryT f c #

(*>) :: DynamicQueryT f a -> DynamicQueryT f b -> DynamicQueryT f b #

(<*) :: DynamicQueryT f a -> DynamicQueryT f b -> DynamicQueryT f a #

Functor (DynamicQueryT f) Source # 
Instance details

Defined in Aztecs.ECS.Query.Dynamic

Methods

fmap :: (a -> b) -> DynamicQueryT f a -> DynamicQueryT f b #

(<$) :: a -> DynamicQueryT f b -> DynamicQueryT f a #

Operations

fetchMapDynM :: (Monad f, Component a) => (a -> f a) -> ComponentID -> DynamicQueryT f a Source #

zipFetchMapDyn :: Component a => (b -> a -> a) -> ComponentID -> DynamicQueryT f b -> DynamicQueryT f a Source #

zipFetchMapAccumDyn :: Component a => (b -> a -> (c, a)) -> ComponentID -> DynamicQueryT f b -> DynamicQueryT f (c, a) Source #

zipFetchMapDynM :: (Monad f, Component a) => (b -> a -> f a) -> ComponentID -> DynamicQueryT f b -> DynamicQueryT f a Source #

zipFetchMapAccumDynM :: (Monad f, Component a) => (b -> a -> f (c, a)) -> ComponentID -> DynamicQueryT f b -> DynamicQueryT f (c, a) Source #

Filters

Conversion

Running

queryDyn :: Applicative f => DynamicQueryT f a -> Entities -> f ([a], Entities) Source #

Match and update all matched entities.

Since: 0.11

readQuerySingleDyn :: (HasCallStack, Applicative f) => DynamicQueryT f a -> Entities -> f a Source #

Match a single entity.

Since: 0.11

readQuerySingleMaybeDyn :: Applicative f => DynamicQueryT f a -> Entities -> f (Maybe a) Source #

Match a single entity, or Nothing.

Since: 0.11

readQueryDyn :: Applicative f => DynamicQueryT f a -> Entities -> f [a] Source #

Match all entities.

Since: 0.11

querySingleDyn :: (HasCallStack, Applicative m) => DynamicQueryT m a -> Entities -> m (a, Entities) Source #

Match and update a single entity.

Since: 0.11

querySingleMaybeDyn :: Applicative f => DynamicQueryT f a -> Entities -> f (Maybe a, Entities) Source #

Match and update a single entity, or Nothing.

Since: 0.11

Internal

data QueryFilter Source #

Query filter.

Since: 0.11

data Operation f a where Source #

Constructors

Fetch :: Component a => Operation f a 
FetchMaybe :: Component a => Operation f (Maybe a) 
FetchMap :: Component a => (a -> a) -> Operation f a 
FetchMapM :: (Monad f, Component a) => (a -> f a) -> Operation f a 
ZipFetchMap :: Component a => (b -> a -> (c, a)) -> DynamicQueryT f b -> Operation f (c, a) 
ZipFetchMapM :: (Monad f, Component a) => (b -> a -> f (c, a)) -> DynamicQueryT f b -> Operation f (c, a) 
With :: Operation f () 
Without :: Operation f ()