| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Mischief.ECS.World.Query
Synopsis
- has :: forall c m w. (MonadSystem w m, ToFilterComponent c) => c -> Entity -> m Bool
- data Query (m :: Type -> Type) a
- query :: MonadSystem w m => Query m out -> m [out]
- query_ :: MonadSystem w m => Query m out -> m ()
- 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
- single :: MonadSystem w m => Query m out -> m (Maybe 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 ()
- qcollect :: forall w (m :: Type -> Type) a. MonadSystem w m => Query m a -> Query m [a]
- qlift :: MonadSystem w m => m a -> Query m a
- qiter :: forall w (m :: Type -> Type) t a. (MonadSystem w m, Foldable t) => t a -> Query m a
- qlifter :: (MonadSystem w m, Foldable t) => m (t a) -> Query m a
- qdebug :: forall w (m :: Type -> Type). (HasCallStack, MonadSystem w m) => Text -> Query m ()
- qinfo :: forall w (m :: Type -> Type). (HasCallStack, MonadSystem w m) => Text -> Query m ()
- qwarn :: forall w (m :: Type -> Type). (HasCallStack, MonadSystem w m) => Text -> Query m ()
- qerr :: forall w (m :: Type -> Type). (HasCallStack, MonadSystem w m) => Text -> Query m ()
- qpar :: forall w (m :: Type -> Type) a. MonadSystem w m => Query ParSystem a -> Query m a
Documentation
has :: forall c m w. (MonadSystem w m, ToFilterComponent c) => c -> Entity -> m Bool Source #
data Query (m :: Type -> Type) a Source #
A Query is a chain of operations which return a list of values when ran.
Instances
| MonadSystem w m => Alternative (Query m) Source # | |
| MonadSystem w m => Applicative (Query m) Source # | |
| MonadSystem w m => Functor (Query m) Source # | |
| MonadSystem w m => Monad (Query m) Source # | |
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 #
single :: MonadSystem w m => Query m out -> m (Maybe out) Source #
Run a Query, returning an element only if it was the only result.
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.
qcollect :: forall w (m :: Type -> Type) a. MonadSystem w m => Query m a -> Query m [a] Source #
Run a query and collect its elements into a list. The query will not stop, even if the returned list is empty.
qlift :: MonadSystem w m => m a -> Query m a Source #
Lift a system action into the query.
qiter :: forall w (m :: Type -> Type) t a. (MonadSystem w m, Foldable t) => t a -> Query m a Source #
Iterate over a Foldable (such as [] or Maybe). This will make the query run over every
element from this point forward.
If you provide no elements (e.g. an empty list or Nothing), no further logic will run.
qdebug :: forall w (m :: Type -> Type). (HasCallStack, MonadSystem w m) => Text -> Query m () Source #
Logs a DEBUG message.
qinfo :: forall w (m :: Type -> Type). (HasCallStack, MonadSystem w m) => Text -> Query m () Source #
Logs an INFO message.
qwarn :: forall w (m :: Type -> Type). (HasCallStack, MonadSystem w m) => Text -> Query m () Source #
Logs a WARNING message.
qerr :: forall w (m :: Type -> Type). (HasCallStack, MonadSystem w m) => Text -> Query m () Source #
Logs an ERROR message.