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 | Safe-Inferred |
Language | Haskell2010 |
Aztecs.ECS.Query
Description
Synopsis
- type Query = QueryT Identity
- newtype QueryT f a = Query {
- runQuery :: Components -> (Components, DynamicQueryT f a)
- entity :: QueryT f EntityID
- fetch :: forall f a. Component a => QueryT f a
- fetchMaybe :: forall f a. Component a => QueryT f (Maybe a)
- fetchMap :: forall f a. Component a => (a -> a) -> QueryT f a
- fetchMapM :: forall f a. (Monad f, Component a) => (a -> f a) -> QueryT f a
- zipFetchMap :: forall f a b. Component a => (b -> a -> a) -> QueryT f b -> QueryT f a
- zipFetchMapAccum :: forall f a b c. Component a => (b -> a -> (c, a)) -> QueryT f b -> QueryT f (c, a)
- zipFetchMapM :: forall f a b. (Monad f, Component a) => (b -> a -> f a) -> QueryT f b -> QueryT f a
- zipFetchMapAccumM :: forall f a b c. (Monad f, Component a) => (b -> a -> f (c, a)) -> QueryT f b -> QueryT f (c, a)
- with :: forall f a. Component a => QueryT f ()
- without :: forall f a. Component a => QueryT f ()
- fromDyn :: DynamicQueryT f a -> QueryT f a
- liftQuery :: (MonadTrans g, Monad (g f), Monad f) => QueryT f a -> QueryT (g f) a
- query :: Applicative f => QueryT f a -> Entities -> f ([a], Entities)
- querySingle :: (HasCallStack, Applicative f) => QueryT f a -> Entities -> f (a, Entities)
- querySingleMaybe :: Applicative m => QueryT m a -> Entities -> m (Maybe a, Entities)
- queryEntities :: Monad m => [EntityID] -> QueryT m a -> Entities -> m ([a], Entities)
- readQueryEntities :: Applicative f => [EntityID] -> QueryT f a -> Entities -> f ([a], Entities)
- readQuery :: Applicative f => QueryT f a -> Entities -> f ([a], Entities)
- readQuerySingle :: (HasCallStack, Applicative f) => QueryT f a -> Entities -> f (a, Entities)
- readQuerySingleMaybe :: Applicative f => QueryT f a -> Entities -> f (Maybe a, Entities)
Queries
Query for matching entities.
Since: 0.11
Constructors
Query | |
Fields
|
Instances
Applicative f => Applicative (QueryT f) Source # | Since: 0.11 |
Functor (QueryT f) Source # | |
Operations
fetchMaybe :: forall f a. Component a => QueryT f (Maybe a) Source #
Fetch a component, or Nothing
.
Since: 0.12
fetchMap :: forall f a. Component a => (a -> a) -> QueryT f a Source #
Fetch a component and map it, storing the result.
Since: 0.11
fetchMapM :: forall f a. (Monad f, Component a) => (a -> f a) -> QueryT f a Source #
Fetch a component and map it with a monadic function, storing the result.
Since: 0.11
zipFetchMap :: forall f a b. Component a => (b -> a -> a) -> QueryT f b -> QueryT f a Source #
Fetch a component and map it with some input, storing the result.
Since: 0.11
zipFetchMapAccum :: forall f a b c. Component a => (b -> a -> (c, a)) -> QueryT f b -> QueryT f (c, a) Source #
Fetch a component and map it with some input, storing the result and returning some output.
Since: 0.11
zipFetchMapM :: forall f a b. (Monad f, Component a) => (b -> a -> f a) -> QueryT f b -> QueryT f a Source #
Fetch a component and map it with some input and a monadic function, storing the result.
Since: 0.11
zipFetchMapAccumM :: forall f a b c. (Monad f, Component a) => (b -> a -> f (c, a)) -> QueryT f b -> QueryT f (c, a) Source #
Fetch a component and map it with some input and a monadic function, storing the result and returning some output.
Since: 0.11
Filters
with :: forall f a. Component a => QueryT f () Source #
Filter for entities with a component.
Since: 0.11
without :: forall f a. Component a => QueryT f () Source #
Filter for entities without a component.
Since: 0.11
Conversion
fromDyn :: DynamicQueryT f a -> QueryT f a Source #
Convert a DynamicQueryT
to a QueryT
.
Since: 0.11
Running
Writing
query :: Applicative f => QueryT f a -> Entities -> f ([a], Entities) Source #
Match and update all entities.
Since: 0.11
querySingle :: (HasCallStack, Applicative f) => QueryT f a -> Entities -> f (a, Entities) Source #
Match and update a single matched entity.
Since: 0.12
querySingleMaybe :: Applicative m => QueryT m a -> Entities -> m (Maybe a, Entities) Source #
Match and update a single matched entity, or Nothing
.
Since: 0.12
queryEntities :: Monad m => [EntityID] -> QueryT m a -> Entities -> m ([a], Entities) Source #
Match and update the specified entities.
Since: 0.12
Reading
readQueryEntities :: Applicative f => [EntityID] -> QueryT f a -> Entities -> f ([a], Entities) Source #
Match the specified entities.
Since: 0.12
readQuery :: Applicative f => QueryT f a -> Entities -> f ([a], Entities) Source #
Match and update all entities.
Since: 0.12
readQuerySingle :: (HasCallStack, Applicative f) => QueryT f a -> Entities -> f (a, Entities) Source #
Match a single entity.
Since: 0.12
readQuerySingleMaybe :: Applicative f => QueryT f a -> Entities -> f (Maybe a, Entities) Source #
Match a single entity, or Nothing
.
Since: 0.12