summaryrefslogtreecommitdiff
path: root/HsBot/Base/Env.hs
diff options
context:
space:
mode:
authorpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-28 11:09:30 +0000
committerpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-28 11:09:30 +0000
commit80ff91aa5d6cda6adc1c97dc39b950dd7daed9d5 (patch)
tree4b1ad4310067e9ee9b5dcbae027844ed596e015f /HsBot/Base/Env.hs
parent7a7302c5b86e89f3fc2fbc3476db731dfd6ed11b (diff)
git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@50 9f8f72e9-4bf4-416e-b76e-7d4203597157
Diffstat (limited to 'HsBot/Base/Env.hs')
-rw-r--r--HsBot/Base/Env.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/HsBot/Base/Env.hs b/HsBot/Base/Env.hs
new file mode 100644
index 0000000..58b2347
--- /dev/null
+++ b/HsBot/Base/Env.hs
@@ -0,0 +1,19 @@
+module HsBot.Base.Env where
+
+import HsBot.Base.Conf
+import HsBot.Base.State
+
+type Dispatch = String -> (String -> IO ()) -> Env -> IO Env
+data Env = DispatchEnv State Conf Dispatch | Env State Conf
+
+castEnv :: Env -> Env
+castEnv (DispatchEnv state conf _) = Env state conf
+
+envGetInt :: String -> Env -> Int
+envGetInt key (Env _ conf) = getUnwrappedInt key conf
+envGetInt key env = envGetInt key (castEnv env)
+
+envGet :: String -> Env -> String
+envGet key (Env _ conf) = getUnwrapped key conf
+envGet key env = envGet key (castEnv env)
+