diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-28 23:14:50 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-28 23:14:50 +0200 |
commit | b2e4264e7849f322cbb2bb592b15d2ea7aec9149 (patch) | |
tree | aea74b3cf9311932e243f7088b0e3377616aa329 /events/src/Main.hs | |
parent | 69081d160dbf6f7d06b9cafd876e0fea423b8066 (diff) | |
download | events-b2e4264e7849f322cbb2bb592b15d2ea7aec9149.tar events-b2e4264e7849f322cbb2bb592b15d2ea7aec9149.tar.gz events-b2e4264e7849f322cbb2bb592b15d2ea7aec9149.tar.bz2 events-b2e4264e7849f322cbb2bb592b15d2ea7aec9149.tar.xz events-b2e4264e7849f322cbb2bb592b15d2ea7aec9149.zip |
Switch from monoid to foldable container
Diffstat (limited to 'events/src/Main.hs')
-rw-r--r-- | events/src/Main.hs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/events/src/Main.hs b/events/src/Main.hs index 0454f22..a4ffa5a 100644 --- a/events/src/Main.hs +++ b/events/src/Main.hs | |||
@@ -11,18 +11,23 @@ import Control.Lens | |||
11 | import Control.Monad | 11 | import Control.Monad |
12 | import Control.Monad.Trans | 12 | import Control.Monad.Trans |
13 | import Data.Aeson.Lens | 13 | import Data.Aeson.Lens |
14 | import Data.Aeson | ||
15 | 14 | ||
16 | import Debug.Trace | 15 | import Debug.Trace |
17 | 16 | ||
17 | import Data.Maybe (isJust) | ||
18 | |||
18 | import qualified ListT | 19 | import qualified ListT |
20 | import qualified Events.Types.NDT as NDT | ||
19 | 21 | ||
20 | main :: IO () | 22 | main :: IO () |
21 | -- main = test $ [ Nop | 23 | main = test $ do |
22 | -- , Override [("blub", String "Haha!")] | 24 | n <- lift $ NDT.fromFoldable ([1..] :: [Integer]) |
23 | -- , Occurs True | 25 | -- objOccurs .= (n <= 5) |
24 | -- , Occurs False | 26 | objOccurs .= (n >= 2) |
25 | -- ] | 27 | objPayload ?= [ ("num", Yaml.Number $ fromIntegral n) |
26 | -- where | 28 | ] |
27 | -- test = CBS.putStr . Yaml.encode <=< evaluate . interpret | 29 | where |
28 | main = undefined | 30 | test = CBS.putStr . Yaml.encode <=< evaluate predicate |
31 | predicate :: Monad m => Maybe Yaml.Object -> m Bool | ||
32 | predicate Nothing = return True | ||
33 | predicate (Just obj) = return . maybe False (<= 5) . traceShowId $ obj ^. at "num" . asDouble | ||