apecs-stm 0.1.3 → 0.1.4
raw patch · 4 files changed
+42/−33 lines, 4 files
Files
- CHANGELOG.md +4/−0
- apecs-stm.cabal +28/−30
- src/Apecs/STM.hs +9/−2
- src/Apecs/STM/Prelude.hs +1/−1
CHANGELOG.md view
@@ -1,3 +1,7 @@+## [0.1.4]+### Add+- (#74) `makeWorldAndComponents`, similar to how it exists in apecs proper+ ## [0.1.3] ### Changed - (#60) Add `Component` type names in non-existent component errors
apecs-stm.cabal view
@@ -1,19 +1,17 @@-name: apecs-stm-version: 0.1.3-homepage: https://github.com/jonascarpay/apecs-stm#readme-license: BSD3-license-file: LICENSE-author: Jonas Carpay-maintainer: jonascarpay@gmail.com-category: Game, Control, Data-build-type: Simple-cabal-version: >=1.10-synopsis: STM stores for apecs-description:- Apecs stores that live in the STM monad, and other tools.-+name: apecs-stm+version: 0.1.4+homepage: https://github.com/jonascarpay/apecs-stm#readme+license: BSD3+license-file: LICENSE+author: Jonas Carpay+maintainer: jonascarpay@gmail.com+category: Game, Control, Data+build-type: Simple+cabal-version: >=1.10+synopsis: STM stores for apecs+description: Apecs stores that live in the STM monad, and other tools. extra-source-files:- README.md,+ README.md CHANGELOG.md source-repository head@@ -21,20 +19,20 @@ location: git://github.com/jonascarpay/apecs-stm.git library- hs-source-dirs:- src+ hs-source-dirs: src exposed-modules:- Apecs.STM, Apecs.STM.Prelude- default-language:- Haskell2010+ Apecs.STM+ Apecs.STM.Prelude++ default-language: Haskell2010 build-depends:- apecs >= 0.7 && < 0.10,- base >= 4.9 && < 5,- containers >= 0.5 && < 0.8,- list-t >= 1 && < 1.2,- stm >= 2.3 && < 3,- stm-containers >= 1.1 && < 2,- template-haskell >= 2.12 && < 3,- vector >= 0.10 && < 0.13- ghc-options:- -Wall+ apecs >=0.7 && <0.10+ , base >=4.9 && <5+ , containers >=0.5 && <0.8+ , list-t >=1 && <1.2+ , stm >=2.3 && <3+ , stm-containers >=1.1 && <2+ , template-haskell >=2.12 && <3+ , vector >=0.10 && <0.13++ ghc-options: -Wall
src/Apecs/STM.hs view
@@ -18,7 +18,7 @@ , Global (..) -- * EntityCounter , EntityCounter (..)- , nextEntity, newEntity, makeWorld+ , nextEntity, newEntity, makeWorld, makeWorldAndComponents -- * STM conveniences , atomically, retry, check, forkSys, threadDelay, STM ) where@@ -40,7 +40,7 @@ import Apecs (ask, get, global, lift, liftIO, runSystem, set) import Apecs.Core-import Apecs.TH (makeWorldNoEC)+import Apecs.TH (makeWorldNoEC, makeMapComponentsFor) newtype Map c = Map (M.Map Int c) type instance Elem (Map c) = c@@ -184,6 +184,13 @@ -- | Like @makeWorld@ from @Apecs@, but uses the STM @EntityCounter@ makeWorld :: String -> [Name] -> Q [Dec] makeWorld worldName cTypes = makeWorldNoEC worldName (cTypes ++ [''EntityCounter])++-- | Like @makeWorldAndComponents@ from @Apecs@, but uses the STM @EntityCounter@ and the STM @Map@+makeWorldAndComponents :: String -> [Name] -> Q [Dec]+makeWorldAndComponents worldName cTypes = do+ wdecls <- makeWorld worldName cTypes+ cdecls <- makeMapComponentsFor ''Map cTypes+ pure $ wdecls ++ cdecls -- | @atomically@ from STM, lifted to the System level. atomically :: SystemT w STM a -> SystemT w IO a
src/Apecs/STM/Prelude.hs view
@@ -7,7 +7,7 @@ ) where import Apecs hiding (EntityCounter, Global, Map, System, Unique,- makeWorld, newEntity)+ makeWorld, makeWorldAndComponents, newEntity) import Apecs.STM type System w a = SystemT w STM a