summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-04-16 19:36:07 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-04-16 19:36:07 +0200
commit364b40e6d8c42f0864fbe0afbe1633d9914ca226 (patch)
tree13e606707575a9aebae96334b755cee6a57d49ca
parentb32f827fad4620ab02d764389a5a1ade7a4ee1e4 (diff)
downloadevents-364b40e6d8c42f0864fbe0afbe1633d9914ca226.tar
events-364b40e6d8c42f0864fbe0afbe1633d9914ca226.tar.gz
events-364b40e6d8c42f0864fbe0afbe1633d9914ca226.tar.bz2
events-364b40e6d8c42f0864fbe0afbe1633d9914ca226.tar.xz
events-364b40e6d8c42f0864fbe0afbe1633d9914ca226.zip
More sensible nomenclature
-rw-r--r--events/src/Events/Types.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/events/src/Events/Types.hs b/events/src/Events/Types.hs
index 54aa34d..4527fc7 100644
--- a/events/src/Events/Types.hs
+++ b/events/src/Events/Types.hs
@@ -6,8 +6,8 @@
6module Events.Types 6module Events.Types
7 ( TimeRange(..), rangeStart, rangeDuration 7 ( TimeRange(..), rangeStart, rangeDuration
8 , Event(..), payload, occursWithin 8 , Event(..), payload, occursWithin
9 , SpecCtx(..), ctxVars, ctxEvents 9 , EvalCtx(..), ctxVars, ctxEvents
10 , Spec, interpret 10 , Eval, evaluate
11 , module Data.Aeson 11 , module Data.Aeson
12 , module Data.Time.Clock 12 , module Data.Time.Clock
13 , module Data.Default.Class 13 , module Data.Default.Class
@@ -42,21 +42,21 @@ data Event = Event
42 } 42 }
43makeLenses ''Event 43makeLenses ''Event
44 44
45data SpecCtx = SpecCtx 45data EvalCtx = EvalCtx
46 { _ctxVars :: Object 46 { _ctxVars :: Object
47 , _ctxEvents :: [Event] 47 , _ctxEvents :: [Event]
48 } 48 }
49makeLenses ''SpecCtx 49makeLenses ''EvalCtx
50 50
51instance Default SpecCtx where 51instance Default EvalCtx where
52 def = SpecCtx 52 def = EvalCtx
53 { _ctxVars = mempty 53 { _ctxVars = mempty
54 , _ctxEvents = mempty 54 , _ctxEvents = mempty
55 } 55 }
56 56
57type Spec m a = ListT (StateT SpecCtx m) a 57type Eval m a = ListT (StateT EvalCtx m) a
58 58
59interpret :: MonadFix m => Spec m (Maybe Event) -> m [Event] 59evaluate :: MonadFix m => Eval m (Maybe Event) -> m [Event]
60interpret x = catMaybes <$> mfix x' 60evaluate x = catMaybes <$> mfix x'
61 where 61 where
62 x' = evalStateT (ListT.toList x) . flip (set ctxEvents) def . catMaybes 62 x' = evalStateT (ListT.toList x) . flip (set ctxEvents) def . catMaybes