-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathMain.hs
More file actions
39 lines (37 loc) · 1.69 KB
/
Main.hs
File metadata and controls
39 lines (37 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{-# LANGUAGE LambdaCase #-}
module Main (main) where
import Client (createExpClient, expStartPolling,
getApplicableVariants, getExpClient,
getFilteredSatisfiedExperiments,
getRunningExperiments,
getSatisfiedExperiments)
import Control.Concurrent
import Prelude
main :: IO ()
main = do
createExpClient "dev" 10 "http://localhost:8080" >>= \case
Left err -> putStrLn err
Right _ -> pure ()
-- threadId <- forkIO (expStartPolling "dev")
-- print threadId
getExpClient "dev" >>= \case
Left err -> putStrLn err
Right client -> loopNTimes 10 client
pure ()
where
loopNTimes 0 _ = return ()
loopNTimes n client = do
runningExperiments <- getRunningExperiments client
satisfiedExperiments <- getSatisfiedExperiments client "{}" "{\"os\": \"android\", \"client\": \"1mg\"}" Nothing
filteredExperiments <- getFilteredSatisfiedExperiments client "{}" (Just "{\"os\": \"android\"}") (Just "hyperpay")
variants <- getApplicableVariants client "{}" "{\"os\": \"android\", \"client\": \"1mg\"}" "1mg-android" Nothing
print "Running experiments"
print runningExperiments
print "experiments that satisfy context"
print satisfiedExperiments
print "experiments after filtering"
print filteredExperiments
print "variant ID applied"
print variants
-- threadDelay 10000000
loopNTimes (n-1) client