packages feed

apecs-stm 0.1.1 → 0.1.2

raw patch · 3 files changed

+19/−13 lines, 3 filesdep ~apecsdep ~basedep ~containersPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: apecs, base, containers, list-t, stm, stm-containers, template-haskell, vector

API changes (from Hackage documentation)

- Apecs.STM.Prelude: KProxy :: KProxy t
- Apecs.STM.Prelude: asProxyTypeOf :: () => a -> proxy a -> a
- Apecs.STM.Prelude: data KProxy t

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ ## [Unreleased] +## [0.1.2]+### Changed+- apecs version bump+ ## [0.1.0] ### Added - Split out the STM parts of the main apecs package
apecs-stm.cabal view
@@ -1,5 +1,5 @@ name:                apecs-stm-version:             0.1.1+version:             0.1.2 homepage:            https://github.com/jonascarpay/apecs-stm#readme license:             BSD3 license-file:        LICENSE@@ -28,13 +28,13 @@   default-language:     Haskell2010   build-depends:-    base >= 4.7 && < 5,-    containers,-    stm,-    list-t,-    vector,-    template-haskell,-    stm-containers,-    apecs >= 0.7+    apecs            >= 0.7  && < 0.9,+    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
@@ -48,9 +48,11 @@   explInit = Map <$> M.new instance ExplGet STM (Map c) where   {-# INLINE explExists #-}-  explExists (Map m) ety = isJust   <$> M.lookup ety m   {-# INLINE explGet #-}-  explGet    (Map m) ety = fromJust <$> M.lookup ety m+  explExists (Map m) ety = isJust   <$> M.lookup ety m+  explGet    (Map m) ety = flip fmap (M.lookup ety m) $ \case+    Just c -> c+    Nothing -> error $ "Reading non-existant STM Map component for entity " <> show ety instance ExplSet STM (Map c) where   {-# INLINE explSet #-}   explSet (Map m) ety x = M.insert x ety m@@ -66,8 +68,8 @@   explInit = S.atomically explInit instance ExplGet IO (Map c) where   {-# INLINE explExists #-}-  explExists m e = S.atomically $ explExists m e   {-# INLINE explGet #-}+  explExists m e = S.atomically $ explExists m e   explGet m e = S.atomically $ explGet m e instance ExplSet IO (Map c) where   {-# INLINE explSet #-}@@ -87,8 +89,8 @@ instance ExplGet STM (Unique c) where   {-# INLINE explGet #-}   explGet (Unique ref) _ = flip fmap (readTVar ref) $ \case-    Nothing -> error "Reading empty Unique"     Just (_, c)  -> c+    Nothing -> error $ "Reading non-existant Unique component"   {-# INLINE explExists #-}   explExists (Unique ref) ety = maybe False ((==ety) . fst) <$> readTVar ref