aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Sunet <jeannekamikaze@gmail.com>2012-09-02 11:28:53 +0200
committerMarc Sunet <jeannekamikaze@gmail.com>2012-09-02 11:28:53 +0200
commitf4443882ac3dad333a4a80468f61f156f5adb6d5 (patch)
tree69b3f8950b7dc30a0136b7bb1f0c5293a6aa41ae
parent72b93bbaaa0219f1161448b3e6136b795b0f2041 (diff)
Added query
-rw-r--r--Spear/Scene/Scene.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Spear/Scene/Scene.hs b/Spear/Scene/Scene.hs
index b58c149..57a9a40 100644
--- a/Spear/Scene/Scene.hs
+++ b/Spear/Scene/Scene.hs
@@ -10,6 +10,7 @@ module Spear.Scene.Scene
10, Spear.Scene.Scene.filter 10, Spear.Scene.Scene.filter
11 -- * Queries 11 -- * Queries
12, find 12, find
13, query
13 -- * Update and render 14 -- * Update and render
14, update 15, update
15, updateM 16, updateM
@@ -75,6 +76,11 @@ find :: (obj -> Bool) -> Scene obj -> Maybe obj
75find pred (scene@ListScene {}) = L.find pred $ objects scene 76find pred (scene@ListScene {}) = L.find pred $ objects scene
76 77
77 78
79-- | Return all objects that satisfy the given predicate.
80query :: (obj -> Bool) -> Scene obj -> [obj]
81query pred (scene@ListScene {}) = L.filter pred $ objects scene
82
83
78type Update obj = obj -> obj 84type Update obj = obj -> obj
79 85
80 86