Safe Haskell | None |
---|---|
Language | Haskell2010 |
- runSystem :: System w a -> w -> IO a
- runWith :: w -> System w a -> IO a
- owners :: forall w c. Has w c => System w (Slice c)
- exists :: forall w c. Has w c => Entity c -> System w Bool
- destroy :: forall w c. Has w c => Entity c -> System w ()
- resetStore :: forall w c p. Has w c => p c -> System w ()
- get :: forall w c. Has w c => Entity c -> System w (Safe c)
- getUnsafe :: forall w c. Has w c => Entity c -> System w c
- set :: forall w c e. Has w c => Entity e -> c -> System w ()
- set' :: forall w c. Has w c => Entity c -> Safe c -> System w ()
- modify :: forall w c. Has w c => Entity c -> (c -> c) -> System w ()
- imapM_ :: forall w c. Has w c => (Entity c -> System w ()) -> System w ()
- imapM :: forall w c a. Has w c => (Entity c -> System w a) -> System w [a]
- cmap :: forall world c. Has world c => (c -> c) -> System world ()
- cmapM_ :: forall w c. Has w c => (c -> System w ()) -> System w ()
- cimapM_ :: forall w c. Has w c => ((Entity c, c) -> System w ()) -> System w ()
- cmapM :: forall w c a. Has w c => (c -> System w a) -> System w [a]
- cimapM :: forall w c a. Has w c => ((Entity c, c) -> System w a) -> System w [a]
- cmap' :: forall world c. Has world c => (c -> Safe c) -> System world ()
- rmap :: forall world r w. (Has world w, Has world r) => (r -> w) -> System world ()
- rmap' :: forall world r w. (Has world w, Has world r, Store (Storage r), Store (Storage w)) => (r -> Safe w) -> System world ()
- wmap :: forall world r w. (Has world w, Has world r, Store (Storage r), Store (Storage w)) => (Safe r -> w) -> System world ()
- wmap' :: forall world r w. (Has world w, Has world r, Store (Storage r), Store (Storage w)) => (Safe r -> Safe w) -> System world ()
- getGlobal :: forall w c. (Has w c, GlobalStore (Storage c)) => System w c
- setGlobal :: forall w c. (Has w c, GlobalStore (Storage c)) => c -> System w ()
- modifyGlobal :: forall w c. (Has w c, GlobalStore (Storage c)) => (c -> c) -> System w ()
Documentation
owners :: forall w c. Has w c => System w (Slice c) Source #
A slice containing all entities with component c
exists :: forall w c. Has w c => Entity c -> System w Bool Source #
Returns whether the given entity has component c
For composite components, this indicates whether the component
has all its constituents
destroy :: forall w c. Has w c => Entity c -> System w () Source #
Destroys the component c
for the given entity
resetStore :: forall w c p. Has w c => p c -> System w () Source #
Removes all components. Equivalent to manually iterating and deleting, but usually optimized.
get :: forall w c. Has w c => Entity c -> System w (Safe c) Source #
Gets the component for a given entity. This is a safe access, because the entity might not have the requested components.
getUnsafe :: forall w c. Has w c => Entity c -> System w c Source #
Same as get
, but does not return a safe value and therefore errors if the target component is not present.
set :: forall w c e. Has w c => Entity e -> c -> System w () Source #
Writes a component to a given entity. Will overwrite existing components. The type was originally 'Entity c -> c -> System w ()', but is relaxed to 'Entity e' so you don't always have to write 'set . cast'
set' :: forall w c. Has w c => Entity c -> Safe c -> System w () Source #
Same as set
, but uses Safe to possibly delete a component
modify :: forall w c. Has w c => Entity c -> (c -> c) -> System w () Source #
Applies a function if possible. Equivalent to reading, mapping, and writing, but stores can provide optimized implementations.
imapM_ :: forall w c. Has w c => (Entity c -> System w ()) -> System w () Source #
Monadically iterate a system over all entities that have that component. Note that writing to the store while iterating over it is undefined behaviour.
imapM :: forall w c a. Has w c => (Entity c -> System w a) -> System w [a] Source #
Monadically iterate a system over all entities that have that component. Note that writing to the store while iterating over it is undefined behaviour.
cmap :: forall world c. Has world c => (c -> c) -> System world () Source #
Maps a pure function over all components
cimapM_ :: forall w c. Has w c => ((Entity c, c) -> System w ()) -> System w () Source #
indexed cmapM_
, also gives the current entity.
cmapM :: forall w c a. Has w c => (c -> System w a) -> System w [a] Source #
mapM version of cmap. Can be used to get a list of entities
As the type signature implies, and unlike cmap
, the return value is not written to the component store.
cimapM :: forall w c a. Has w c => ((Entity c, c) -> System w a) -> System w [a] Source #
indexed cmapM
, also gives the current entity.
cmap' :: forall world c. Has world c => (c -> Safe c) -> System world () Source #
Maps a function that might delete its components
rmap :: forall world r w. (Has world w, Has world r) => (r -> w) -> System world () Source #
Maps a function over all entities with a r
, and writes their w
rmap' :: forall world r w. (Has world w, Has world r, Store (Storage r), Store (Storage w)) => (r -> Safe w) -> System world () Source #
Maps a function over all entities with a r
, and writes or deletes their w
wmap :: forall world r w. (Has world w, Has world r, Store (Storage r), Store (Storage w)) => (Safe r -> w) -> System world () Source #
For all entities with a w
, this map reads their r
and writes their w
wmap' :: forall world r w. (Has world w, Has world r, Store (Storage r), Store (Storage w)) => (Safe r -> Safe w) -> System world () Source #
For all entities with a w
, this map reads their r
and writes or deletes their w
getGlobal :: forall w c. (Has w c, GlobalStore (Storage c)) => System w c Source #
Reads a global value
setGlobal :: forall w c. (Has w c, GlobalStore (Storage c)) => c -> System w () Source #
Writes a global value
modifyGlobal :: forall w c. (Has w c, GlobalStore (Storage c)) => (c -> c) -> System w () Source #
Modifies a global value