summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-04-16 18:47:53 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-04-16 18:47:53 +0200
commitb32f827fad4620ab02d764389a5a1ade7a4ee1e4 (patch)
tree9c7f71044922b157efe96730a30af4af6737f996
parent91a52b1e265a288b0c425dafcb1fa1098fbd3cc9 (diff)
downloadevents-b32f827fad4620ab02d764389a5a1ade7a4ee1e4.tar
events-b32f827fad4620ab02d764389a5a1ade7a4ee1e4.tar.gz
events-b32f827fad4620ab02d764389a5a1ade7a4ee1e4.tar.bz2
events-b32f827fad4620ab02d764389a5a1ade7a4ee1e4.tar.xz
events-b32f827fad4620ab02d764389a5a1ade7a4ee1e4.zip
Made context mutable during interpretation
-rw-r--r--events/src/Events/Types.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/events/src/Events/Types.hs b/events/src/Events/Types.hs
index 1f41454..54aa34d 100644
--- a/events/src/Events/Types.hs
+++ b/events/src/Events/Types.hs
@@ -19,7 +19,7 @@ import Data.Aeson (Object)
19 19
20import Data.Time.Clock 20import Data.Time.Clock
21 21
22import Control.Monad.Reader 22import Control.Monad.State.Lazy
23import ListT (ListT) 23import ListT (ListT)
24import qualified ListT 24import qualified ListT
25 25
@@ -54,9 +54,9 @@ instance Default SpecCtx where
54 , _ctxEvents = mempty 54 , _ctxEvents = mempty
55 } 55 }
56 56
57type Spec m a = ListT (ReaderT SpecCtx m) a 57type Spec m a = ListT (StateT SpecCtx m) a
58 58
59interpret :: MonadFix m => Spec m (Maybe Event) -> m [Event] 59interpret :: MonadFix m => Spec m (Maybe Event) -> m [Event]
60interpret x = catMaybes <$> mfix x' 60interpret x = catMaybes <$> mfix x'
61 where 61 where
62 x' = runReaderT (ListT.toList x) . flip (set ctxEvents) def . catMaybes 62 x' = evalStateT (ListT.toList x) . flip (set ctxEvents) def . catMaybes