packages feed

apecs-stm 0.1.5 → 0.2

raw patch · 4 files changed

+16/−37 lines, 4 filesdep ~containersnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: containers

API changes (from Hackage documentation)

- Apecs.STM: EntityCounter :: Sum Int -> EntityCounter
- Apecs.STM: [getCounter] :: EntityCounter -> Sum Int
- Apecs.STM: instance Apecs.Core.Component Apecs.STM.EntityCounter
- Apecs.STM: instance GHC.Base.Monoid Apecs.STM.EntityCounter
- Apecs.STM: instance GHC.Base.Semigroup Apecs.STM.EntityCounter
- Apecs.STM: instance GHC.Classes.Eq Apecs.STM.EntityCounter
- Apecs.STM: instance GHC.Show.Show Apecs.STM.EntityCounter
- Apecs.STM: makeWorld :: String -> [Name] -> Q [Dec]
- Apecs.STM: newEntity :: (Set w m c, Get w m EntityCounter, Set w m EntityCounter) => c -> SystemT w m Entity
- Apecs.STM: newtype EntityCounter
- Apecs.STM: nextEntity :: (Get w m EntityCounter, Set w m EntityCounter) => SystemT w m Entity
+ Apecs.STM.Prelude: collect :: forall components w (m :: Type -> Type) a. (Get w m components, Members w m components) => (components -> Maybe a) -> SystemT w m [a]
+ Apecs.STM.Prelude: data EntityCounter
+ Apecs.STM.Prelude: makeWorld :: String -> [Name] -> Q [Dec]
+ Apecs.STM.Prelude: newEntity :: forall (m :: Type -> Type) w c. (MonadIO m, Set w m c, Get w m EntityCounter) => c -> SystemT w m Entity

Files

CHANGELOG.md view
@@ -1,3 +1,9 @@+## [0.2]+### Removed+- Removed custom `EntityCounter`, `newEntity`, and `makeWorld`.+### Changed+- (#118) Use `makeWorld`, `EntityCounter` and entity functions from core.+ ## [0.1.5] ### Changed - Bumped the minimum apecs version to 0.9.3, since we need `makeMapComponentsFor`
apecs-stm.cabal view
@@ -1,6 +1,6 @@ name:               apecs-stm-version:            0.1.5-homepage:           https://github.com/jonascarpay/apecs-stm#readme+version:            0.2+homepage:           https://github.com/jonascarpay/apecs license:            BSD3 license-file:       LICENSE author:             Jonas Carpay@@ -16,7 +16,7 @@  source-repository head   type:     git-  location: git://github.com/jonascarpay/apecs-stm.git+  location: git://github.com/jonascarpay/apecs.git  library   hs-source-dirs:   src@@ -33,6 +33,6 @@     , stm               >=2.3   && <3     , stm-containers    >=1.1   && <2     , template-haskell  >=2.12  && <3-    , vector            >=0.10  && <0.13+    , vector            >=0.10  && <0.14    ghc-options:      -Wall
src/Apecs/STM.hs view
@@ -16,10 +16,8 @@     Map (..)   , Unique (..)   , Global (..)-    -- * EntityCounter-  , EntityCounter (..)-  , nextEntity, newEntity, makeWorld, makeWorldAndComponents     -- * STM conveniences+  , makeWorldAndComponents   , atomically, retry, check, forkSys, threadDelay, STM   ) where @@ -29,18 +27,15 @@ import           Control.Concurrent.STM.TVar as S import           Control.Monad import           Data.Maybe-import           Data.Monoid                 (Sum (..))-import           Data.Semigroup import           Data.Typeable (Typeable, typeRep) import qualified Data.Vector.Unboxed         as U import           Language.Haskell.TH import qualified ListT                       as L import qualified StmContainers.Map           as M -import           Apecs                       (ask, get, global, lift, liftIO,-                                              runSystem, set)+import           Apecs                       (ask, lift, liftIO, runSystem) import           Apecs.Core-import           Apecs.TH                    (makeWorldNoEC, makeMapComponentsFor)+import           Apecs.TH                    (makeWorld, makeMapComponentsFor)  newtype Map c = Map (M.Map Int c) type instance Elem (Map c) = c@@ -163,29 +158,7 @@   {-# INLINE explSet #-}   explSet m e x = S.atomically $ explSet m e x -newtype EntityCounter = EntityCounter {getCounter :: Sum Int} deriving (Semigroup, Monoid, Eq, Show)--instance Component EntityCounter where-  type Storage EntityCounter = Global EntityCounter--{-# INLINE nextEntity #-}-nextEntity :: (Get w m EntityCounter, Set w m EntityCounter) => SystemT w m Entity-nextEntity = do EntityCounter n <- get global-                set global (EntityCounter $ n+1)-                return (Entity . getSum $ n)--{-# INLINE newEntity #-}-newEntity :: (Set w m c, Get w m EntityCounter, Set w m EntityCounter)-          => c -> SystemT w m Entity-newEntity c = do ety <- nextEntity-                 set ety c-                 return ety---- | 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@+-- | Like @makeWorldAndComponents@ from @Apecs@, but uses the STM 'Map' makeWorldAndComponents :: String -> [Name] -> Q [Dec] makeWorldAndComponents worldName cTypes = do   wdecls <- makeWorld worldName cTypes
src/Apecs/STM/Prelude.hs view
@@ -6,8 +6,8 @@   , module Apecs   ) where -import           Apecs     hiding (EntityCounter, Global, Map, System, Unique,-                            makeWorld, makeWorldAndComponents, newEntity)+import           Apecs     hiding (Global, Map, System, Unique,+                            makeWorldAndComponents) import           Apecs.STM  type System w a = SystemT w STM a