diff options
| author | pb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157> | 2010-03-28 11:09:30 +0000 |
|---|---|---|
| committer | pb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157> | 2010-03-28 11:09:30 +0000 |
| commit | 80ff91aa5d6cda6adc1c97dc39b950dd7daed9d5 (patch) | |
| tree | 4b1ad4310067e9ee9b5dcbae027844ed596e015f /HsBot/Base/Cmd.hs | |
| parent | 7a7302c5b86e89f3fc2fbc3476db731dfd6ed11b (diff) | |
git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@50 9f8f72e9-4bf4-416e-b76e-7d4203597157
Diffstat (limited to 'HsBot/Base/Cmd.hs')
| -rw-r--r-- | HsBot/Base/Cmd.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/HsBot/Base/Cmd.hs b/HsBot/Base/Cmd.hs new file mode 100644 index 0000000..c4963ac --- /dev/null +++ b/HsBot/Base/Cmd.hs @@ -0,0 +1,16 @@ +module HsBot.Base.Cmd where + +import HsBot.Base.State + +data Cmd = Cmd String String (State -> IO ()) + +instance Show Cmd where + show (Cmd a b _) = a ++ " - " ++ b + +cmdGet :: String -> [Cmd] -> Maybe Cmd +cmdGet x commands = + let command = [ (Cmd a b c) | (Cmd a b c) <- commands, a == x ] + in if length command == 0 + then Nothing + else Just (head command) + |
