Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains STM-supporting versions of regular apecs stores, and some convenience functions.
It is designed to be imported qualified, since it shadows both apecs and STM names.
There is also an Apecs.STM.Prelude
module, which can be imported by itself.
Note that if you want to be able to create entities in STM, you will also need to use a STM-supported EntityCounter
, typically done through this module's makeWorld
.
Synopsis
- newtype Map c = Map (Map Int c)
- newtype Unique c = Unique (TVar (Maybe (Int, c)))
- newtype Global c = Global (TVar c)
- newtype EntityCounter = EntityCounter {
- getCounter :: Sum Int
- nextEntity :: (Get w m EntityCounter, Set w m EntityCounter) => SystemT w m Entity
- newEntity :: (Set w m c, Get w m EntityCounter, Set w m EntityCounter) => c -> SystemT w m Entity
- makeWorld :: String -> [Name] -> Q [Dec]
- makeWorldAndComponents :: String -> [Name] -> Q [Dec]
- atomically :: SystemT w STM a -> SystemT w IO a
- retry :: SystemT w STM a
- check :: Bool -> SystemT w STM ()
- forkSys :: SystemT w IO () -> SystemT w IO ThreadId
- threadDelay :: Int -> SystemT w IO ()
- data STM a
Stores
Instances
ExplInit IO (Map c) Source # | |
ExplInit STM (Map c) Source # | |
Typeable c => ExplGet IO (Map c) Source # | |
Typeable c => ExplGet STM (Map c) Source # | |
ExplSet IO (Map c) Source # | |
ExplSet STM (Map c) Source # | |
ExplDestroy IO (Map c) Source # | |
ExplDestroy STM (Map c) Source # | |
ExplMembers IO (Map c) Source # | |
ExplMembers STM (Map c) Source # | |
type Elem (Map c) Source # | |
Instances
ExplInit IO (Unique c) Source # | |
ExplInit STM (Unique c) Source # | |
Typeable c => ExplGet IO (Unique c) Source # | |
Typeable c => ExplGet STM (Unique c) Source # | |
ExplSet IO (Unique c) Source # | |
ExplSet STM (Unique c) Source # | |
ExplDestroy IO (Unique c) Source # | |
ExplDestroy STM (Unique c) Source # | |
ExplMembers IO (Unique c) Source # | |
ExplMembers STM (Unique c) Source # | |
type Elem (Unique c) Source # | |
EntityCounter
newtype EntityCounter Source #
Instances
Eq EntityCounter Source # | |
Defined in Apecs.STM (==) :: EntityCounter -> EntityCounter -> Bool # (/=) :: EntityCounter -> EntityCounter -> Bool # | |
Show EntityCounter Source # | |
Defined in Apecs.STM showsPrec :: Int -> EntityCounter -> ShowS # show :: EntityCounter -> String # showList :: [EntityCounter] -> ShowS # | |
Semigroup EntityCounter Source # | |
Defined in Apecs.STM (<>) :: EntityCounter -> EntityCounter -> EntityCounter # sconcat :: NonEmpty EntityCounter -> EntityCounter # stimes :: Integral b => b -> EntityCounter -> EntityCounter # | |
Monoid EntityCounter Source # | |
Defined in Apecs.STM mempty :: EntityCounter # mappend :: EntityCounter -> EntityCounter -> EntityCounter # mconcat :: [EntityCounter] -> EntityCounter # | |
Component EntityCounter Source # | |
Defined in Apecs.STM type Storage EntityCounter # | |
type Storage EntityCounter Source # | |
Defined in Apecs.STM |
nextEntity :: (Get w m EntityCounter, Set w m EntityCounter) => SystemT w m Entity Source #
newEntity :: (Set w m c, Get w m EntityCounter, Set w m EntityCounter) => c -> SystemT w m Entity Source #
makeWorld :: String -> [Name] -> Q [Dec] Source #
Like makeWorld
from Apecs
, but uses the STM EntityCounter
makeWorldAndComponents :: String -> [Name] -> Q [Dec] Source #
Like makeWorldAndComponents
from Apecs
, but uses the STM EntityCounter
and the STM Map
STM conveniences
atomically :: SystemT w STM a -> SystemT w IO a Source #
atomically
from STM, lifted to the System level.
threadDelay :: Int -> SystemT w IO () Source #
Suspends the current thread for a number of microseconds.
A monad supporting atomic memory transactions.
Instances
Monad STM | Since: base-4.3.0.0 |
Functor STM | Since: base-4.3.0.0 |
Applicative STM | Since: base-4.8.0.0 |
Alternative STM | Since: base-4.8.0.0 |
MonadPlus STM | Since: base-4.3.0.0 |
MonadBaseControl STM STM | |
Monoid c => ExplInit STM (Global c) Source # | |
ExplInit STM (Unique c) Source # | |
ExplInit STM (Map c) Source # | |
ExplGet STM (Global c) Source # | |
Typeable c => ExplGet STM (Unique c) Source # | |
Typeable c => ExplGet STM (Map c) Source # | |
ExplSet STM (Global c) Source # | |
ExplSet STM (Unique c) Source # | |
ExplSet STM (Map c) Source # | |
ExplDestroy STM (Unique c) Source # | |
ExplDestroy STM (Map c) Source # | |
ExplMembers STM (Unique c) Source # | |
ExplMembers STM (Map c) Source # | |
type StM STM a | |
Defined in Control.Monad.Trans.Control |