apecs 0.9.4 → 0.9.5
raw patch · 5 files changed
+29/−13 lines, 5 filesdep ~mtlnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: mtl
API changes (from Hackage documentation)
- Apecs: type family Storage c;
+ Apecs: collect :: forall components w m a. (Get w m components, Members w m components) => (components -> Maybe a) -> SystemT w m [a]
+ Apecs: type Storage c;
+ Apecs.Core: type Storage c;
+ Apecs.System: collect :: forall components w m a. (Get w m components, Members w m components) => (components -> Maybe a) -> SystemT w m [a]
Files
- CHANGELOG.md +6/−0
- README.md +9/−9
- apecs.cabal +3/−3
- src/Apecs.hs +1/−1
- src/Apecs/System.hs +10/−0
CHANGELOG.md view
@@ -1,3 +1,9 @@+## [0.9.5]+### Added+- (#99) `collect`+### Changed+- (#84) Updated links to articles+ ## [0.9.4] ### Changed - (#86) Add support for GHC 9.2 and Template Haskell 2.18
README.md view
@@ -16,11 +16,11 @@ - [tutorial](https://github.com/jonascarpay/apecs/blob/master/examples/Shmup.md) and other [examples](https://github.com/jonascarpay/apecs/tree/master/examples) ##### Games/articles-- [An Introduction to Developing Games in Haskell with Apecs](https://aas.sh/blog/making-a-game-with-haskell-and-apecs/)-- [mallRL](https://github.com/nmaehlmann/mallRL) - a _grocery shopping roguelike_-- [An implementation of the Unity tutorial project using apecs](https://github.com/mewhhaha/apecs-unity-tutorial-haskell)-- [SpaceMar](https://gitlab.com/dpwiz/spacemar)-- [Achtung die haskell](https://github.com/mewhhaha/achtung-die-haskell)+- [Notakto](https://github.com/Ashe/Notakto/), and [associated blog post/apecs tutorial](https://aas.sh/blog/notakto-a-haskell-game-with-apecs-and-raylib/) by [@Ashe](https://github.com/Ashe)+- [mallRL](https://github.com/nmaehlmann/mallRL) - a _grocery shopping roguelike_ by [@nmaehlmann](https://github.com/nmaehlmann)+- [An implementation of the Unity tutorial project using apecs](https://github.com/mewhhaha/apecs-unity-tutorial-haskell) by [@mewhhaha](https://github.com/mewhhaha)+- [SpaceMar](https://gitlab.com/dpwiz/spacemar) by [@dpwiz](https://gitlab.com/dpwiz)+- [Achtung die haskell](https://github.com/mewhhaha/achtung-die-haskell) by [@mewhhaha](https://github.com/mewhhaha) - [(Your game here)](https://github.com/jonascarpay/apecs/pulls) ##### Packages@@ -35,14 +35,14 @@ [](https://hackage.haskell.org/package/apecs-physics) [](https://www.stackage.org/package/apecs-physics)- [](https://www.stackage.org/package/apecs-physics) + [](https://www.stackage.org/package/apecs-physics) [](https://travis-ci.org/jonascarpay/apecs) - [apecs-gloss](https://github.com/jonascarpay/apecs/tree/master/apecs-gloss) - Simple frontend for [gloss](http://hackage.haskell.org/package/gloss)-based rendering - [](https://hackage.haskell.org/package/apecs-gloss) - [](https://www.stackage.org/package/apecs-gloss) - [](https://www.stackage.org/package/apecs-gloss) + [](https://hackage.haskell.org/package/apecs-gloss)+ [](https://www.stackage.org/package/apecs-gloss)+ [](https://www.stackage.org/package/apecs-gloss) [](https://travis-ci.org/jonascarpay/apecs) - [apecs-stm](https://github.com/jonascarpay/apecs/tree/master/apecs-stm) - STM-based stores for easy concurrency
apecs.cabal view
@@ -1,5 +1,5 @@ name: apecs-version: 0.9.4+version: 0.9.5 homepage: https://github.com/jonascarpay/apecs#readme license: BSD3 license-file: LICENSE@@ -44,7 +44,7 @@ , exceptions >=0.10.0 && <0.11 , mtl >=2.2 && <2.3 , template-haskell >=2.12 && <3- , vector >=0.11 && <0.13+ , vector >=0.11 && <0.14 ghc-options: -Wall @@ -58,7 +58,7 @@ , containers >=0.5 && <0.8 , linear >=1.20 && <2 , QuickCheck >=2.10 && <3- , vector >=0.10 && <0.13+ , vector >=0.10 && <0.14 default-language: Haskell2010 ghc-options: -Wall
src/Apecs.hs view
@@ -16,7 +16,7 @@ destroy, exists, modify, ($~), cmap, cmapM, cmapM_,- cfold, cfoldM, cfoldM_,+ cfold, cfoldM, cfoldM_, collect, -- * Other runSystem, runWith,
src/Apecs/System.hs view
@@ -161,3 +161,13 @@ s :: Storage c <- getStore sl <- lift$ explMembers s U.foldM'_ (\a e -> lift (explGet s e) >>= sys a) a0 sl++-- | Collect matching components into a list by using the specified test/process function.+-- You can use this to preprocess data before returning.+-- And you can do a test here that depends on data from multiple components.+-- Pass "Just" to simply collect all the items.+{-# INLINE collect #-}+collect :: forall components w m a. (Get w m components, Members w m components)+ => (components -> Maybe a)+ -> SystemT w m [a]+collect f = cfold (\acc -> maybe acc (: acc) . f) []