diff options
Diffstat (limited to 'events/src/Events/Eval.hs')
-rw-r--r-- | events/src/Events/Eval.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/events/src/Events/Eval.hs b/events/src/Events/Eval.hs new file mode 100644 index 0000000..c5bc134 --- /dev/null +++ b/events/src/Events/Eval.hs | |||
@@ -0,0 +1,16 @@ | |||
1 | module Events.Eval | ||
2 | ( evaluate | ||
3 | ) where | ||
4 | |||
5 | import Control.Monad.Fix (MonadFix(mfix)) | ||
6 | |||
7 | import Events.Types | ||
8 | |||
9 | import Data.Maybe (catMaybes) | ||
10 | |||
11 | import Control.Lens | ||
12 | |||
13 | evaluate :: MonadFix m => (Maybe Object -> StateT EvalCtx m Bool) -> Eval m () -> m [Object] | ||
14 | evaluate predicate x = catMaybes <$> mfix x' | ||
15 | where | ||
16 | x' = evalStateT (foldNDT predicate (preview objCtx <$> execStateT x def)) . flip (set ctxEvents) def . catMaybes | ||