| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Mischief.ECS.World.Query
Synopsis
- findArchetypes :: forall qd m w output. (Queryable qd output, MonadSystem w m) => qd -> m (Set ArchetypeId)
- entityQuery :: forall qd output m w. (Queryable qd output, MonadSystem w m) => qd -> Entity -> m (Maybe output)
- class GetComponentId c where
- getComponentId' :: forall w (m :: Type -> Type). MonadSystem w m => c -> FilterComponent
- tryMetaLocal :: forall c m w. (Component c, MonadSystem w m) => m (Maybe Entity)
- has :: forall c m w. (MonadSystem w m, ToFilterComponent c) => c -> Entity -> m Bool
- data Query (m :: Type -> Type) a where
- BuildQuery :: forall qd a (m :: Type -> Type). Queryable qd a => qd -> QueryFilter -> Maybe [Entity] -> Query m a
- MapQuery :: forall (m :: Type -> Type) b a. Query m b -> (Entity -> b -> m a) -> Query m a
- FilterQuery :: forall (m :: Type -> Type) a. Query m a -> (Entity -> a -> m Bool) -> Query m a
- PairEntityQuery :: forall (m :: Type -> Type) a1. Query m a1 -> Query m (Entity, a1)
- DoQuery :: forall (m :: Type -> Type) a b. Query m a -> (Entity -> a -> m b) -> Query m a
- CollectQuery :: forall (m :: Type -> Type) a1. Query m a1 -> Query m [From a1]
- PureQuery :: forall a (m :: Type -> Type). a -> Query m a
- AppQuery :: forall (m :: Type -> Type) a1 a. Query m (a1 -> a) -> Query m a1 -> Query m a
- BindQuery :: forall (m :: Type -> Type) a1 a. Query m a1 -> (a1 -> Query m a) -> Query m a
- EmptyQuery :: forall (m :: Type -> Type) a. Query m a
- RefocusQuery :: forall (m :: Type -> Type) a. Query m a -> Entity -> Query m a
- StopQuery :: forall (m :: Type -> Type) a. Query m a
- IterQuery :: forall a (m :: Type -> Type). [From a] -> Query m a
- ParQuery :: forall a (m :: Type -> Type). Query ParSystem a -> Query m a
- qrun :: MonadSystem w m => Query m out -> m [(Entity, out)]
- qrunPar :: Query ParSystem a -> ParSystem [(Entity, a)]
- tryJoin :: (Entity, a) -> (Entity, a -> b) -> Maybe (Entity, b)
- query :: MonadSystem w m => Query m out -> m [out]
- query_ :: MonadSystem w m => Query m out -> m ()
- single :: MonadSystem w m => Query m out -> m (Maybe out)
- queryOne :: MonadSystem w m => Query m out -> m (Maybe out)
- mkQuery :: forall qd out (m :: Type -> Type). Queryable qd out => qd -> Query m out
- mkQuery' :: forall qd out (m :: Type -> Type). Queryable qd out => qd -> QueryFilter -> Query m out
- mkGet :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> Query m out
- mkGet' :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> QueryFilter -> Query m out
- check :: forall m w. MonadSystem w m => QueryFilter -> Entity -> m Bool
- runWhenQ :: Typeable a => Query System a -> ([a] -> System b) -> System ()
- runWhenOne :: Typeable a => Query System a -> (a -> System b) -> System ()
- filterToQuery :: ToFilterComponent a => World -> a -> IO (Maybe (ComponentId, ComponentQuery))
- filterArchetypes :: MonadSystem w m => Set ArchetypeId -> QueryFilter -> m (Set ArchetypeId)
Documentation
findArchetypes :: forall qd m w output. (Queryable qd output, MonadSystem w m) => qd -> m (Set ArchetypeId) Source #
entityQuery :: forall qd output m w. (Queryable qd output, MonadSystem w m) => qd -> Entity -> m (Maybe output) Source #
class GetComponentId c where Source #
Methods
getComponentId' :: forall w (m :: Type -> Type). MonadSystem w m => c -> FilterComponent Source #
tryMetaLocal :: forall c m w. (Component c, MonadSystem w m) => m (Maybe Entity) Source #
has :: forall c m w. (MonadSystem w m, ToFilterComponent c) => c -> Entity -> m Bool Source #
data Query (m :: Type -> Type) a where Source #
A Query is a chain of operations which return a list of values when ran.
Constructors
| BuildQuery :: forall qd a (m :: Type -> Type). Queryable qd a => qd -> QueryFilter -> Maybe [Entity] -> Query m a | |
| MapQuery :: forall (m :: Type -> Type) b a. Query m b -> (Entity -> b -> m a) -> Query m a | |
| FilterQuery :: forall (m :: Type -> Type) a. Query m a -> (Entity -> a -> m Bool) -> Query m a | |
| PairEntityQuery :: forall (m :: Type -> Type) a1. Query m a1 -> Query m (Entity, a1) | |
| DoQuery :: forall (m :: Type -> Type) a b. Query m a -> (Entity -> a -> m b) -> Query m a | |
| CollectQuery :: forall (m :: Type -> Type) a1. Query m a1 -> Query m [From a1] | |
| PureQuery :: forall a (m :: Type -> Type). a -> Query m a | |
| AppQuery :: forall (m :: Type -> Type) a1 a. Query m (a1 -> a) -> Query m a1 -> Query m a | |
| BindQuery :: forall (m :: Type -> Type) a1 a. Query m a1 -> (a1 -> Query m a) -> Query m a | |
| EmptyQuery :: forall (m :: Type -> Type) a. Query m a | |
| RefocusQuery :: forall (m :: Type -> Type) a. Query m a -> Entity -> Query m a | |
| StopQuery :: forall (m :: Type -> Type) a. Query m a | |
| IterQuery :: forall a (m :: Type -> Type). [From a] -> Query m a | |
| ParQuery :: forall a (m :: Type -> Type). Query ParSystem a -> Query m a |
Instances
| MonadSystem w m => Applicative (Query m) Source # | |
| MonadSystem w m => Functor (Query m) Source # | |
| MonadSystem w m => Monad (Query m) Source # | |
single :: MonadSystem w m => Query m out -> m (Maybe out) Source #
Run a Query, returning an element only if it was the only result.
queryOne :: MonadSystem w m => Query m out -> m (Maybe out) Source #
Run a Query, returning an arbitrary element produced by it, or nothing if the query was null.
mkQuery' :: forall qd out (m :: Type -> Type). Queryable qd out => qd -> QueryFilter -> Query m out Source #
mkGet :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> Query m out Source #
mkGet' :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> QueryFilter -> Query m out Source #
check :: forall m w. MonadSystem w m => QueryFilter -> Entity -> m Bool Source #
runWhenQ :: Typeable a => Query System a -> ([a] -> System b) -> System () Source #
Same as runWhen, but runs when the provided query is not empty.
runWhenOne :: Typeable a => Query System a -> (a -> System b) -> System () Source #
Same as runWhen, but runs when the provided query is not empty. Picks an arbitrary element to pass forward.
filterToQuery :: ToFilterComponent a => World -> a -> IO (Maybe (ComponentId, ComponentQuery)) Source #
filterArchetypes :: MonadSystem w m => Set ArchetypeId -> QueryFilter -> m (Set ArchetypeId) Source #