Safe Haskell | None |
---|---|
Language | Haskell2010 |
Apecs.Components
Contents
Synopsis
- data Not a = Not
- newtype NotStore s = NotStore s
- newtype MaybeStore s = MaybeStore s
- data EitherStore sa sb = EitherStore sa sb
- data Filter c = Filter
- newtype FilterStore s = FilterStore s
- data EntityStore = EntityStore
Documentation
Psuedocomponent indicating the absence of a
.
Mainly used as e.g. cmap $ (a, Not b) -> c
to iterate over entities with an a
but no b
.
Can also be used to delete components, like cmap $ a -> (Not :: Not a)
to delete every a
component.
Constructors
Not |
Pseudostore used to produce values of type Not a
, inverts explExists
, and destroys instead of explSet
.
Constructors
NotStore s |
newtype MaybeStore s Source #
Pseudostore used to produce values of type Maybe a
.
Will always return True
for explExists
.
Writing can both set and delete a component using Just
and Nothing
respectively.
Constructors
MaybeStore s |
Instances
(ExplDestroy m s, ExplSet m s) => ExplSet m (MaybeStore s) Source # | |
Defined in Apecs.Components Methods explSet :: MaybeStore s -> Int -> Elem (MaybeStore s) -> m () Source # | |
ExplGet m s => ExplGet m (MaybeStore s) Source # | |
Defined in Apecs.Components Methods explGet :: MaybeStore s -> Int -> m (Elem (MaybeStore s)) Source # explExists :: MaybeStore s -> Int -> m Bool Source # | |
type Elem (MaybeStore s) Source # | |
Defined in Apecs.Components |
data EitherStore sa sb Source #
Used for Either
, a logical disjunction between two components.
As expected, Either is used to model error values.
Getting an Either a b
will first attempt to get a b
and return it as Right b
, or if it does not exist, get an a
as Left a
.
Can also be used to set one of two things.
Constructors
EitherStore sa sb |
Instances
(ExplDestroy m sa, ExplDestroy m sb) => ExplDestroy m (EitherStore sa sb) Source # | |
Defined in Apecs.Components Methods explDestroy :: EitherStore sa sb -> Int -> m () Source # | |
(ExplSet m sa, ExplSet m sb) => ExplSet m (EitherStore sa sb) Source # | |
Defined in Apecs.Components Methods explSet :: EitherStore sa sb -> Int -> Elem (EitherStore sa sb) -> m () Source # | |
(ExplGet m sa, ExplGet m sb) => ExplGet m (EitherStore sa sb) Source # | |
Defined in Apecs.Components Methods explGet :: EitherStore sa sb -> Int -> m (Elem (EitherStore sa sb)) Source # explExists :: EitherStore sa sb -> Int -> m Bool Source # | |
type Elem (EitherStore sa sb) Source # | |
Defined in Apecs.Components |
Pseudocomponent that functions normally for explExists
and explMembers
, but always return Filter
for explGet
.
Can be used in cmap as cmap $ (Filter :: Filter a) -> b
.
Since the above can be written more consicely as cmap $ (_ :: a) -> b
, it is rarely directly.
More interestingly, we can define reusable filters like movables = Filter :: Filter (Position, Velocity)
.
Note that 'Filter c' is equivalent to 'Not (Not c)'.
Constructors
Filter |
newtype FilterStore s Source #
Constructors
FilterStore s |
Instances
ExplMembers m s => ExplMembers m (FilterStore s) Source # | |
Defined in Apecs.Components Methods explMembers :: FilterStore s -> m (Vector Int) Source # | |
ExplGet m s => ExplGet m (FilterStore s) Source # | |
Defined in Apecs.Components Methods explGet :: FilterStore s -> Int -> m (Elem (FilterStore s)) Source # explExists :: FilterStore s -> Int -> m Bool Source # | |
type Elem (FilterStore s) Source # | |
Defined in Apecs.Components |
data EntityStore Source #
Pseudostore used to produce components of type Entity
.
Always returns True
for explExists
, and echoes back the entity argument for explGet
.
Used in e.g. cmap $ (a, ety :: Entity) -> b
to access the current entity.
Constructors
EntityStore |
Instances
Monad m => ExplGet m EntityStore Source # | |
Defined in Apecs.Components Methods explGet :: EntityStore -> Int -> m (Elem EntityStore) Source # explExists :: EntityStore -> Int -> m Bool Source # | |
type Elem EntityStore Source # | |
Defined in Apecs.Components |
Orphan instances
Component () Source # | |
Component Entity Source # | |
Monad m => ExplDestroy m () Source # | |
Methods explDestroy :: () -> Int -> m () Source # | |
Monad m => ExplSet m () Source # | |
Monad m => ExplGet m () Source # | |
Monad m => Has w m Entity Source # | |
Monad m => Has w m () Source # | |
Has w m c => Has w m (Identity c) Source # | |
Has w m c => Has w m (Maybe c) Source # | |
(Has w m ca, Has w m cb) => Has w m (Either ca cb) Source # | |
(Has w m t_0, Has w m t_1) => Has w m (t_0, t_1) Source # | |
(Has w m t_0, Has w m t_1, Has w m t_2) => Has w m (t_0, t_1, t_2) Source # | |
(Has w m t_0, Has w m t_1, Has w m t_2, Has w m t_3) => Has w m (t_0, t_1, t_2, t_3) Source # | |
(Has w m t_0, Has w m t_1, Has w m t_2, Has w m t_3, Has w m t_4) => Has w m (t_0, t_1, t_2, t_3, t_4) Source # | |
(Has w m t_0, Has w m t_1, Has w m t_2, Has w m t_3, Has w m t_4, Has w m t_5) => Has w m (t_0, t_1, t_2, t_3, t_4, t_5) Source # | |
(Has w m t_0, Has w m t_1, Has w m t_2, Has w m t_3, Has w m t_4, Has w m t_5, Has w m t_6) => Has w m (t_0, t_1, t_2, t_3, t_4, t_5, t_6) Source # | |
(Has w m t_0, Has w m t_1, Has w m t_2, Has w m t_3, Has w m t_4, Has w m t_5, Has w m t_6, Has w m t_7) => Has w m (t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7) Source # | |
ExplMembers m s => ExplMembers m (Identity s) Source # | |
ExplDestroy m s => ExplDestroy m (Identity s) Source # | |
Methods explDestroy :: Identity s -> Int -> m () Source # | |
ExplSet m s => ExplSet m (Identity s) Source # | |
ExplGet m s => ExplGet m (Identity s) Source # | |
(ExplMembers m t_0, ExplGet m t_1) => ExplMembers m (t_0, t_1) Source # | |
Methods explMembers :: (t_0, t_1) -> m (Vector Int) Source # | |
(ExplDestroy m t_0, ExplDestroy m t_1) => ExplDestroy m (t_0, t_1) Source # | |
Methods explDestroy :: (t_0, t_1) -> Int -> m () Source # | |
(ExplSet m t_0, ExplSet m t_1) => ExplSet m (t_0, t_1) Source # | |
(ExplGet m t_0, ExplGet m t_1) => ExplGet m (t_0, t_1) Source # | |
(ExplMembers m t_0, ExplGet m t_1, ExplGet m t_2) => ExplMembers m (t_0, t_1, t_2) Source # | |
Methods explMembers :: (t_0, t_1, t_2) -> m (Vector Int) Source # | |
(ExplDestroy m t_0, ExplDestroy m t_1, ExplDestroy m t_2) => ExplDestroy m (t_0, t_1, t_2) Source # | |
Methods explDestroy :: (t_0, t_1, t_2) -> Int -> m () Source # | |
(ExplSet m t_0, ExplSet m t_1, ExplSet m t_2) => ExplSet m (t_0, t_1, t_2) Source # | |
(ExplGet m t_0, ExplGet m t_1, ExplGet m t_2) => ExplGet m (t_0, t_1, t_2) Source # | |
(ExplMembers m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3) => ExplMembers m (t_0, t_1, t_2, t_3) Source # | |
Methods explMembers :: (t_0, t_1, t_2, t_3) -> m (Vector Int) Source # | |
(ExplDestroy m t_0, ExplDestroy m t_1, ExplDestroy m t_2, ExplDestroy m t_3) => ExplDestroy m (t_0, t_1, t_2, t_3) Source # | |
Methods explDestroy :: (t_0, t_1, t_2, t_3) -> Int -> m () Source # | |
(ExplSet m t_0, ExplSet m t_1, ExplSet m t_2, ExplSet m t_3) => ExplSet m (t_0, t_1, t_2, t_3) Source # | |
(ExplGet m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3) => ExplGet m (t_0, t_1, t_2, t_3) Source # | |
(ExplMembers m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3, ExplGet m t_4) => ExplMembers m (t_0, t_1, t_2, t_3, t_4) Source # | |
Methods explMembers :: (t_0, t_1, t_2, t_3, t_4) -> m (Vector Int) Source # | |
(ExplDestroy m t_0, ExplDestroy m t_1, ExplDestroy m t_2, ExplDestroy m t_3, ExplDestroy m t_4) => ExplDestroy m (t_0, t_1, t_2, t_3, t_4) Source # | |
Methods explDestroy :: (t_0, t_1, t_2, t_3, t_4) -> Int -> m () Source # | |
(ExplSet m t_0, ExplSet m t_1, ExplSet m t_2, ExplSet m t_3, ExplSet m t_4) => ExplSet m (t_0, t_1, t_2, t_3, t_4) Source # | |
(ExplGet m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3, ExplGet m t_4) => ExplGet m (t_0, t_1, t_2, t_3, t_4) Source # | |
(ExplMembers m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3, ExplGet m t_4, ExplGet m t_5) => ExplMembers m (t_0, t_1, t_2, t_3, t_4, t_5) Source # | |
Methods explMembers :: (t_0, t_1, t_2, t_3, t_4, t_5) -> m (Vector Int) Source # | |
(ExplDestroy m t_0, ExplDestroy m t_1, ExplDestroy m t_2, ExplDestroy m t_3, ExplDestroy m t_4, ExplDestroy m t_5) => ExplDestroy m (t_0, t_1, t_2, t_3, t_4, t_5) Source # | |
Methods explDestroy :: (t_0, t_1, t_2, t_3, t_4, t_5) -> Int -> m () Source # | |
(ExplSet m t_0, ExplSet m t_1, ExplSet m t_2, ExplSet m t_3, ExplSet m t_4, ExplSet m t_5) => ExplSet m (t_0, t_1, t_2, t_3, t_4, t_5) Source # | |
(ExplGet m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3, ExplGet m t_4, ExplGet m t_5) => ExplGet m (t_0, t_1, t_2, t_3, t_4, t_5) Source # | |
(ExplMembers m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3, ExplGet m t_4, ExplGet m t_5, ExplGet m t_6) => ExplMembers m (t_0, t_1, t_2, t_3, t_4, t_5, t_6) Source # | |
Methods explMembers :: (t_0, t_1, t_2, t_3, t_4, t_5, t_6) -> m (Vector Int) Source # | |
(ExplDestroy m t_0, ExplDestroy m t_1, ExplDestroy m t_2, ExplDestroy m t_3, ExplDestroy m t_4, ExplDestroy m t_5, ExplDestroy m t_6) => ExplDestroy m (t_0, t_1, t_2, t_3, t_4, t_5, t_6) Source # | |
Methods explDestroy :: (t_0, t_1, t_2, t_3, t_4, t_5, t_6) -> Int -> m () Source # | |
(ExplSet m t_0, ExplSet m t_1, ExplSet m t_2, ExplSet m t_3, ExplSet m t_4, ExplSet m t_5, ExplSet m t_6) => ExplSet m (t_0, t_1, t_2, t_3, t_4, t_5, t_6) Source # | |
(ExplGet m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3, ExplGet m t_4, ExplGet m t_5, ExplGet m t_6) => ExplGet m (t_0, t_1, t_2, t_3, t_4, t_5, t_6) Source # | |
(ExplMembers m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3, ExplGet m t_4, ExplGet m t_5, ExplGet m t_6, ExplGet m t_7) => ExplMembers m (t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7) Source # | |
Methods explMembers :: (t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7) -> m (Vector Int) Source # | |
(ExplDestroy m t_0, ExplDestroy m t_1, ExplDestroy m t_2, ExplDestroy m t_3, ExplDestroy m t_4, ExplDestroy m t_5, ExplDestroy m t_6, ExplDestroy m t_7) => ExplDestroy m (t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7) Source # | |
Methods explDestroy :: (t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7) -> Int -> m () Source # | |
(ExplSet m t_0, ExplSet m t_1, ExplSet m t_2, ExplSet m t_3, ExplSet m t_4, ExplSet m t_5, ExplSet m t_6, ExplSet m t_7) => ExplSet m (t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7) Source # | |
(ExplGet m t_0, ExplGet m t_1, ExplGet m t_2, ExplGet m t_3, ExplGet m t_4, ExplGet m t_5, ExplGet m t_6, ExplGet m t_7) => ExplGet m (t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7) Source # | |
Component c => Component (Maybe c) Source # | |
Component c => Component (Identity c) Source # | Identity component. |
(Component ca, Component cb) => Component (Either ca cb) Source # | |
(Component t_0, Component t_1) => Component (t_0, t_1) Source # | |
(Component t_0, Component t_1, Component t_2) => Component (t_0, t_1, t_2) Source # | |
(Component t_0, Component t_1, Component t_2, Component t_3) => Component (t_0, t_1, t_2, t_3) Source # | |
(Component t_0, Component t_1, Component t_2, Component t_3, Component t_4) => Component (t_0, t_1, t_2, t_3, t_4) Source # | |
(Component t_0, Component t_1, Component t_2, Component t_3, Component t_4, Component t_5) => Component (t_0, t_1, t_2, t_3, t_4, t_5) Source # | |
(Component t_0, Component t_1, Component t_2, Component t_3, Component t_4, Component t_5, Component t_6) => Component (t_0, t_1, t_2, t_3, t_4, t_5, t_6) Source # | |
(Component t_0, Component t_1, Component t_2, Component t_3, Component t_4, Component t_5, Component t_6, Component t_7) => Component (t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7) Source # | |