packages feed

apecs 0.4.1.0 → 0.4.1.1

raw patch · 6 files changed

+11/−7 lines, 6 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Apecs.Util: data EntityCounter
+ Apecs: cfold :: forall w c a. (Members w c, Get w c) => (a -> c -> a) -> a -> System w a
+ Apecs: cfoldM :: forall w c a. (Members w c, Get w c) => (a -> c -> System w a) -> a -> System w a
+ Apecs: cfoldM_ :: forall w c a. (Members w c, Get w c) => (a -> c -> System w a) -> a -> System w ()
+ Apecs: type Destroy w c = (Has w c, ExplDestroy (Storage c))
+ Apecs: type Get w c = (Has w c, ExplGet (Storage c))
+ Apecs: type Members w c = (Has w c, ExplMembers (Storage c))
+ Apecs: type Set w c = (Has w c, ExplSet (Storage c))
+ Apecs.Core: instance Apecs.Core.Has w ()
+ Apecs.Util: EntityCounter :: Sum Int -> EntityCounter
+ Apecs.Util: [getCounter] :: EntityCounter -> Sum Int
+ Apecs.Util: newtype EntityCounter

Files

apecs.cabal view
@@ -1,5 +1,5 @@ name:                apecs-version:             0.4.1.0+version:             0.4.1.1 homepage:            https://github.com/jonascarpay/apecs#readme license:             BSD3 license-file:        LICENSE
bench/Main.hs view
@@ -9,7 +9,6 @@ import Linear  import Apecs-import Apecs.Stores  -- pos_vel newtype ECSPos = ECSPos (V2 Float) deriving (Eq, Show)
src/Apecs.hs view
@@ -6,6 +6,7 @@   module Data.Proxy,   -- * Core types     System(..), Component(..), Entity(..), Has(..), Not(..),+    Get, Set, Destroy, Members,    -- * Stores     Map, Unique, Global, Cache,@@ -14,6 +15,7 @@   -- * Systems     get, set, getAll,     cmap, cmapM, cmapM_,+    cfold, cfoldM, cfoldM_,     modify, destroy, exists,    -- * Other
src/Apecs/Core.hs view
@@ -171,6 +171,8 @@   explSet (EitherStore _ sb) ety (Right b) = explSet sb ety b   explSet (EitherStore sa _) ety (Left a)  = explSet sa ety a +instance Has w () where+  getStore = return () instance Component () where   type Storage () = () type instance Elem () = ()
src/Apecs/Stores.hs view
@@ -62,7 +62,7 @@  instance ExplGet (Unique c) where   {-# INLINE explGet #-}-  explGet (Unique ref) _ = readIORef ref >>= return . \case+  explGet (Unique ref) _ = flip fmap (readIORef ref) $ \case     Nothing -> error "Reading empty Unique"     Just (_, c)  -> c   {-# INLINE explExists #-}@@ -74,11 +74,12 @@  instance ExplDestroy (Unique c) where   {-# INLINE explDestroy #-}-  explDestroy (Unique ref) ety = writeIORef ref Nothing+  explDestroy (Unique ref) ety = do+    readIORef ref >>= mapM_ (flip when (writeIORef ref Nothing) . (==ety) . fst)  instance ExplMembers (Unique c) where   {-# INLINE explMembers #-}-  explMembers (Unique ref) = readIORef ref >>= return . \case+  explMembers (Unique ref) = flip fmap (readIORef ref) $ \case     Nothing -> mempty     Just (ety, _) -> U.singleton ety @@ -116,6 +117,7 @@ data Cache (n :: Nat) s =   Cache Int (UM.IOVector Int) (VM.IOVector (Elem s)) s +cacheMiss :: t cacheMiss = error "Cache miss!"  type instance Elem (Cache n s) = Elem s
src/Apecs/Util.hs view
@@ -11,7 +11,7 @@   runGC, global,    -- * EntityCounter-  EntityCounter, nextEntity, newEntity,+  EntityCounter(..), nextEntity, newEntity,    -- * Spatial hashing   -- $hash@@ -26,7 +26,6 @@ import           Control.Monad.Reader (liftIO) import           Data.Monoid import           Data.Semigroup-import           Data.Proxy import           System.CPUTime import           System.Mem           (performMajorGC)