mischief-ecs
Safe HaskellNone
LanguageGHC2024

Mischief.ECS.World.Query.Markers

Synopsis
  • data E = E
  • data C (a :: k) = C
  • data M (a :: k) = M
  • data Has (a :: k) = Has
  • data Any = Any
  • newtype R (a :: k) b = R b
  • newtype MR (a :: k) b = MR b
  • newtype HasR (a :: k) b = HasR b
  • newtype Q a = Q a
  • data Q' a b = Q' a b
  • newtype Val a = Val a
  • newtype R' (a :: k) b = R' b

Documentation

data E Source #

Used to query for the Entity.

Example

x <- query E

Quasi Notation

  • Entity
  • entity
  • E
  • e

For instance:

x <- [q|Entity|]

Constructors

E 

Instances

Instances details
Queryable E Entity Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

data C (a :: k) Source #

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

Instances details
Component c => EraseIntoStorage (C c) FilterType Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Methods

erase :: C c -> FilterType Source #

Component c => EraseIntoStorage (C c, c -> Bool) CheckFilterType Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Methods

erase :: (C c, c -> Bool) -> CheckFilterType Source #

Component c => Queryable (C c) (Result c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

data M (a :: k) 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 

Instances

Instances details
Component c => Queryable (M c) (Maybe (Result c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

data Has (a :: k) Source #

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 

Instances

Instances details
Component c => Queryable (Has c) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

data Any Source #

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

Instances details
Component c => RelQuery 'Exclusive (MR c Any) (Maybe (Result (Rel c))) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'Exclusive (R c Any) (Result (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'Inclusive (MR c Any) (Maybe [Result (Rel c)]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'Inclusive (R c Any) [Result (Rel c)] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => IntoQueryFilter (CheckR Any c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Component c => EraseIntoStorage (R c Any, c -> Bool) CheckFilterType Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Methods

erase :: (R c Any, c -> Bool) -> CheckFilterType Source #

Component c => EraseIntoStorage (R c Any) FilterType Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Methods

erase :: R c Any -> FilterType Source #

Component c => Queryable (HasR c Any) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (RelExclusivity c) (MR c Any) out => Queryable (MR c Any) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (RelExclusivity c) (R c Any) out => Queryable (R c Any) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

newtype R (a :: k) b Source #

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

Instances details
(Component c, Queryable q out) => RelQuery 'Exclusive (R c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe out) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Exclusive (R c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

relRunQueryInternal :: R c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

relQueryTypes :: R c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

Component c => RelQuery 'Exclusive (R c Any) (Result (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'Inclusive (R c Any) [Result (Rel c)] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'Inclusive (R c (Q q)) [out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe [out]) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [out])] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Inclusive (R c (Q' q f)) [out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q' q f) -> World -> Entity -> IO (Maybe [out]) Source #

relRunQueryInternal :: R c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [out])] Source #

relQueryTypes :: R c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

Component c => EraseIntoStorage (R c Entity, c -> Bool) CheckFilterType Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Methods

erase :: (R c Entity, c -> Bool) -> CheckFilterType Source #

Component c => EraseIntoStorage (R c Any, c -> Bool) CheckFilterType Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Methods

erase :: (R c Any, c -> Bool) -> CheckFilterType Source #

Component c => EraseIntoStorage (R c Entity) FilterType Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Methods

erase :: R c Entity -> FilterType Source #

Component c => EraseIntoStorage (R c Any) FilterType Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Methods

erase :: R c Any -> FilterType Source #

RelQuery (RelExclusivity c) (R c Any) out => Queryable (R c Any) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (RelExclusivity c) (R c (Q q)) out => Queryable (R c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

RelQuery (RelExclusivity c) (R c (Q' q f)) out => Queryable (R c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

Component c => Queryable (R c Entity) (Result (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

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

Instances details
Component c => RelQuery 'Exclusive (MR c Any) (Maybe (Result (Rel c))) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'Exclusive (MR c (Q q)) (Maybe out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe out)) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe out)] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Exclusive (MR c (Q' q f)) (Maybe out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q' q f) -> World -> Entity -> IO (Maybe (Maybe out)) Source #

relRunQueryInternal :: MR c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe out)] Source #

relQueryTypes :: MR c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

Component c => RelQuery 'Inclusive (MR c Any) (Maybe [Result (Rel c)]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'Inclusive (MR c (Q q)) (Maybe [out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe [out])) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [out])] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Inclusive (MR c (Q' q f)) (Maybe [out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q' q f) -> World -> Entity -> IO (Maybe (Maybe [out])) Source #

relRunQueryInternal :: MR c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [out])] Source #

relQueryTypes :: MR c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

RelQuery (RelExclusivity c) (MR c Any) out => Queryable (MR c Any) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (RelExclusivity c) (MR c (Q q)) out => Queryable (MR c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

RelQuery (RelExclusivity c) (MR c (Q' q f)) out => Queryable (MR c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: MR c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: MR c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: MR c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

Component c => Queryable (MR c Entity) (Maybe (Result (Rel c))) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

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 

Instances

Instances details
Component c => Queryable (HasR c Entity) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => Queryable (HasR c Any) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => Queryable (HasR c (Q q)) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out, Collectable f QueryFilter) => Queryable (HasR c (Q' q f)) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

newtype Q a Source #

Used when writing transitive queries. See R.

Constructors

Q a 

Instances

Instances details
(Component c, Queryable q out) => RelQuery 'Exclusive (R c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe out) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'Exclusive (MR c (Q q)) (Maybe out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe out)) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe out)] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'Inclusive (MR c (Q q)) (Maybe [out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe [out])) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [out])] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'Inclusive (R c (Q q)) [out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe [out]) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [out])] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => Queryable (HasR c (Q q)) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (RelExclusivity c) (MR c (Q q)) out => Queryable (MR c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

RelQuery (RelExclusivity c) (R c (Q q)) out => Queryable (R c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

data Q' a b Source #

Used when writing transitive queries with filters. See R.

Constructors

Q' a b 

Instances

Instances details
(Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Exclusive (R c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

relRunQueryInternal :: R c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

relQueryTypes :: R c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Exclusive (MR c (Q' q f)) (Maybe out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q' q f) -> World -> Entity -> IO (Maybe (Maybe out)) Source #

relRunQueryInternal :: MR c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe out)] Source #

relQueryTypes :: MR c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Inclusive (MR c (Q' q f)) (Maybe [out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q' q f) -> World -> Entity -> IO (Maybe (Maybe [out])) Source #

relRunQueryInternal :: MR c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [out])] Source #

relQueryTypes :: MR c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out, Collectable f QueryFilter) => RelQuery 'Inclusive (R c (Q' q f)) [out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q' q f) -> World -> Entity -> IO (Maybe [out]) Source #

relRunQueryInternal :: R c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [out])] Source #

relQueryTypes :: R c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out, Collectable f QueryFilter) => Queryable (HasR c (Q' q f)) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (RelExclusivity c) (MR c (Q' q f)) out => Queryable (MR c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: MR c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: MR c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: MR c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

RelQuery (RelExclusivity c) (R c (Q' q f)) out => Queryable (R c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

newtype Val a 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

Instances details
(Queryable qd out, Mappable MapQueryVal out out') => Queryable (Val qd) out' Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: Val qd -> World -> Entity -> IO (Maybe out') Source #

runQueryInternal :: Val qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, out')] Source #

queryTypes :: Val qd -> Set (TypeRep, TypeQuery) Source #

newtype R' (a :: k) b Source #

Constructors

R' b 

Instances

Instances details
RelQuery 'Inclusive (R c e) out => Queryable (R' c e) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R' c e -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R' c e -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R' c e -> Set (TypeRep, TypeQuery) Source #