| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Mischief.ECS.World.Query.Markers
Documentation
Used to query for the Entity.
Example
x <- query E
Quasi Notation
Entity
entity
E
e
For instance:
x <- [q|Entity|]
Constructors
| E |
Used to query for a component or to remove a component. Forces queries to only include entities which have the component.
Example
Querying:
x <- query (C @Name)
Removing:
remove (C @Name)
Quasi Notation
None, you just write the component name directly. For instance:
x <- [q|Name|]
Constructors
| C |
Instances
| Component c => EraseIntoStorage (C c) FilterType Source # | |
Defined in Mischief.ECS.World.Query.QueryFilter Methods erase :: C c -> FilterType Source # | |
| Component c => EraseIntoStorage (C c, c -> Bool) CheckFilterType Source # | |
Defined in Mischief.ECS.World.Query.QueryFilter | |
| Component c => Queryable (C c) (Result c) Source # | |
Used to query for a component that an entity may or may not have.
Example
x <- query (M @Name)
Quasi Notation
Maybe
maybe
M
m
For instance:
x <- [q|Maybe Name|]
Constructors
| M |
Used in queries to return a Bool which indicates whether a component exists on the entity or not.
Example
x <- query (Has @Name)
Quasi Notation
Has
has
H
h
For instance:
x <- [q|Has Name|]
Constructors
| Has |
Wildcard used when querying for relationships to indicate that you're querying for relationships with any target.
In the case of exclusive relationships, Any returns a single relationship rather than a list of relationships.
Constructors
| Any |
Instances
Used to query for a relationships. Can be used in three different ways:
1. R c e
Queries for a relationship with a specific target. Forces queries to only include entities which have such a relationship.
Example
x <- query (R @Likes alice)
x :: [Result (Rel Likes)]
Quasi Notation
It is written with an arrow like so:
x <- [q|Likes -> alice|]
2. R c Any
Queries for all relationships with any target. Forces queries to only include entities which have at least one such relationship.
Example
x <- query (R @Likes Any)
x :: [[Result (Rel Likes)]]
Quasi Notation
x <- [q|Likes -> *|]
3. R c q
Runs a transitive query on the targets of all such relationships.
q can either be Q d or Q' d f, depending if you want to also run a filter or not.
Similar to the previous case, it will limit the query to only entities which have such a relationship with at least one entity which matches the transitive query.
Example
x <- query (R @Likes (Q (C @Name))
x <- query (R @Likes (Q' (C @Name) (With (C @Enemy))))
x :: [[Result Name]]
Quasi Notation
You just write the given query in the () following the arrow. / can be used to give it a filter.
For instance:
x <- [q|Likes -> (Name)|]
x <- [q|Likes -> (Name / With Enemy)|]
Constructors
| R b |
Instances
newtype MR (a :: k) b Source #
Exactly like R, except that it wraps the result in a Maybe, also including entities that don't have such a relationship.
Example
x <- query (MR @Likes Any)
Quasi Notation
Maybe
maybe
M
m
For instance:
x <- [q|Maybe Likes -> *|]
Constructors
| MR b |
Instances
newtype HasR (a :: k) b Source #
Exactly like R, except that it returns a Bool depending on whether the entity has such a relationship or not.
Example
x <- query (HasR @Likes Any)
Quasi Notation
Has
has
H
h
For instance:
x <- [q|Has Likes -> *|]
Constructors
| HasR b |
Used when writing transitive queries. See R.
Constructors
| Q a |
Instances
| (Component c, Queryable q out) => RelQuery 'Exclusive (R c (Q q)) out Source # | |
| (Component c, Queryable q out) => RelQuery 'Exclusive (MR c (Q q)) (Maybe out) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'Inclusive (MR c (Q q)) (Maybe [out]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out) => RelQuery 'Inclusive (R c (Q q)) [out] Source # | |
| (Component c, Queryable q out) => Queryable (HasR c (Q q)) Bool Source # | |
| RelQuery (RelExclusivity c) (MR c (Q q)) out => Queryable (MR c (Q q)) out Source # | |
| RelQuery (RelExclusivity c) (R c (Q q)) out => Queryable (R c (Q q)) out Source # | |
Used when writing transitive queries with filters. See R.
Constructors
| Q' a b |
Instances
| (Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Exclusive (R c (Q' q f)) out Source # | |
| (Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Exclusive (MR c (Q' q f)) (Maybe out) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Inclusive (MR c (Q' q f)) (Maybe [out]) Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Inclusive (R c (Q' q f)) [out] Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |
| (Component c, Queryable q out, Collectable f QueryFilter) => Queryable (HasR c (Q' q f)) Bool Source # | |
| RelQuery (RelExclusivity c) (MR c (Q' q f)) out => Queryable (MR c (Q' q f)) out Source # | |
| RelQuery (RelExclusivity c) (R c (Q' q f)) out => Queryable (R c (Q' q f)) out Source # | |
Can be wrapped around any queryable marker to unwrap the inner value from the Results.
Example
x <- query (C @Name, Val (C @Name))
x :: [(Result Name, Name)]
y <- query (Val (C @Name, R @Likes Any))
y :: [(Name, [Rel Likes])]
Quasi Notation
Val
val
V
v
*
For instance:
x <- [q|Name, *Name|]
x <- [q|*(Name, Likes -> *)|]
Constructors
| Val a |
Instances
| (Queryable qd out, Mappable MapQueryVal out out') => Queryable (Val qd) out' Source # | |
Defined in Mischief.ECS.World.Query.Queryable | |